New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Container volume masks host volume in the compose file #2308
Comments
I can't reproduce this issue with master .What version of docker-compose are you running? Here's what I ran: web:
image: 'alpine:edge'
volumes:
- '${HOST_PATH}:/contents'
command: 'ls /contents'
|
I was using 1.5.0 RC1 and RC2. I can see that 1.5.0 have just been released. I will try that with your example above. My container looks like this:
|
@dnephin you example worked like you said. I am a noob regarding docker, but here is a theory of what I am seeing. In the mysql Dockerfile In
Ie. I try to define where that "volume" should be located on the host. It appears like this overwrite the At runtime the |
So the solution for me seems to change the default location of the DB from Question though... is this expected behaviour? It isn't clear from reading the docs (well, I expected something else :-)) |
It is by design. I recently added this paragraph to the docs, to try and call attention to it: http://docs.docker.com/compose/#preserve-volume-data-when-containers-are-created But I think it could use more detail |
Maybe we can add a warning when there's a host volume that is going to be ignored for the container volume. I think that would be better than adding documentation that users will have to find. |
I have a little snippet in
docker-compose.yml
like:If I change the value of
HOST_PATH
any subsequentup
orbuild
, the container will still mount the volume with the old value ofHOST_PATH
.Is this because
volumes
is not a run time option likedocker -v
or is this a bug?The text was updated successfully, but these errors were encountered: