Let’s assume that we have an nginx container depends on php container you can use volume_from as of now
nginx:
image: nginx
ports:
- "42080:80"
volumes:
- ./config/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
volumes_from:
- php
php:
build: config/docker/php
ports:
- "42022:22"
volumes:
- .:/var/www/html
env_file: config/docker/php/.env.development
By this approach the volumes of php are exposed to nginx which is not a desired one but until depends_on feature is introduced.
There is a proposal to introduce "depends_on" in the new networking feature introduced by Docker.
The feature depends_on could be used to order the container start-up.
For more information please go through the following tutorial to get more info about docker: