Using docker-compose volumes_from option does not work

769 views Asked by At

In base Dockerfile I ADD some directories from host machine to image. I want to include all directories from container running on base image to another one. So I write a simple .yml file:

app:
   build: .
   links:
    - base
   volumes_from:
    - base

base:
   extends:
   file: docker-base.yml
   service: base

But when I run docker-compose run app /bin/bash and then ls in container I see no base directory inside container. Why? What I'm doing wrong?

2

There are 2 answers

0
Artem Jackson On BEST ANSWER

Sorry for so stupid question.

I've forgot to include VOLUME base instruction to base image Dockerfile, so other containers can't use this mount point

0
pierrelb On

you can't use extends with links and volumes_from in order to avoid implicit dependencies. See more details : docker docs