-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Volume mounted inside another sometimes disappears after file change #6975
Comments
Hello @josh-byster Thank you for the report. We are going to investigate. |
Any updates on this? |
This exactly describes the problem I'm seeing. Again with docker-compose, with a sub-volume containing my |
We have the same issue. Thank @josh-byster for reporting it in this detail. |
Me and my co-worker have also been experiencing this issue to varying degrees. |
Any update on this? |
I have this exact same issue. Output of docker-compose version
Output of docker version
Output of docker-compose config
|
I had this issue before, now on Docker Desktop Community 2.4.0.0 for MacOs I have an issue that when I modify the mounted file on the host machine, it doesn't update the internal/mounted file, unless I restart docker engine completely. |
I'm having this problem as well. I'm using an older version of Docker Desktop on macos because the newer versions have a persistent issue that I can't resolve (c.f. #3927). So I'm running 2.5.0.1. My volumes are mounted like this:
Whenever I change files in the EDIT: I downgraded to 2.4.0.0. The issue doesn't happen on every edit, but does happen at frequent, random intervals. EDIT: Downgraded to 2.3.0.5 and the problem went away. |
this happens on docker-ce on linux
the content of |
did u fix this or solution may share? |
@putrafajarh I never found a solution other than downgrading. Though, I haven't worked on the project that exhibited this behavior in a while. |
Which version is working fine? We are currently experiencing this issue. It's very annoying. |
Maybe this will help to someone.
It mounts |
Just experienced this on a server in production. Docker version 20.10.21, build baeda1f docker-compose version 1.25.0, build unknown
|
@Ralle Docker compose v1 is deprecated and will reach End of Life in a few month, you should consider adoption of Compose v2 for your production server(s). |
Ouch. Yeah. Thanks. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
Not sure if this is a Compose-specific issue or Moby so I have the linked issue here in case it's not Compose-specific.
Summary: We mount our source code in a directory in the container, and within that directory, mount on top a named volume which contains data from the built image (
node_modules
). Sometimes this named volume seems to unmount, resulting in an underlying empty directory in the container.Background: Essentially, I have the mount of the
backend
folder to the container source code located at/var/www/app
. However, since I don't havenode_modules
installed on the host, we have a named volume mounted calledbe_modules
. This has the effect of (when it's working) using the installed node_modules in the image, effectively mounting "on-top" of the source code in/var/www/app
.The key is here in the Docker Compose file, which gets the
node_modules
directory working usually:Issue: Running
docker-compose up
ordocker-compose run backend sh
(for debugging) shows correctly thenode_modules
retrieved from the image. They all show up just fine, and the date/time on thenode_modules
folder when runningls
is whenever the volume got created. All is good.There's an empty
node_modules
directory created on the host, which is normal since it mounted into the container and so the corresponding folder got created on the host.However, occasionally (and more frequent on my coworker's machine) we will make a few changes in the source code while our container is up. The changes syncs up to the container (as it should), however
node_modules
then becomes an empty folder in the container! Moreover, the datetime of the directory changes to the time when the image was built (and is the same as the timestamp of the empty directory on the host)! In other words, it's as if the named volume just randomly unmounts for no reason. Doing nothing to the source but restartingdocker-compose down -v
anddocker-compose up
fixes it until it happens again.What we tried: Restarting Docker, removing all images, containers, volumes, and starting a fresh build.
Why would this be happening? My suspicion is that it's either a Docker / Compose bug since I can't reproduce with the exact same code, or there's some subtlety that I'm missing. I'm almost seems the issue has to do with when a file changes that Docker is re-mounting the entire directory in the container, and this is over-over-writing the
be_modules
mount with that empty directory, since the timestamp between the host empty directory and container empty directory are the same.It's not device specific.
Steps to reproduce the issue:
Can't write an MWE since it doesn't happen always (for me, almost never; my coworker: all the time) and frequency depends on the machine, which makes me suspect that's a bug rather than something else.
Link to docker-compose gist
Link to dockerfile gist
Additional information you deem important (e.g. issue happens only occasionally):
Issue seems to happen randomly on my machine along with some of my coworkers. However, on one coworker's machine, this issue happens almost every time they make a change.
I'm posting here instead of Docker Compose since I think this may be an issue with volume mounting.
Context information (for bug reports)
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
Steps to reproduce the issue
Please see above
We run the following commands in order to reproduce:
Additional information
OS version / distribution,
docker-compose
install method, etc.Running OS X 10.14.6 but see this issue on Docker with WSL.
The text was updated successfully, but these errors were encountered: