V
V
Vlad Tokarev2017-05-03 08:41:09
Virtualization
Vlad Tokarev, 2017-05-03 08:41:09

How to run a command from another container using docker-compose?

Starting to master docker, I created docker-compose.yml with the following content:

version: '3'
services:
    app:
        build: app
        stdin_open: true
        tty: true
        restart: always
    php:
        build:
            context: ./php
        restart: always
        depends_on:
            - app

How can I execute, let 's say php -vfrom the console in the app container?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2017-05-03
@Vadiok

1. ssh
2. install docker in the "app" container, mount /var/run/docker.sock and manage docker on the host from within the container.
Only in this case your container becomes omnipotent, actually gets root on the host.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question