Cannot override the specified file on rprivate's volumes
- [x] I have tried with the latest version of my channel (Stable or Edge)
- [ ] I have uploaded Diagnostics
- Diagnostics ID:
Expected behavior
Actual behavior
I updated Docker Desktop for Max from 2.4.0.0 to 2.5.0.0 a few days ago. After that, cannot override the specified file on rprivate's volumes.
Summary of docker-compose.yml is the following
version: '3'
services:
app:
volumes:
- ./app/html:/var/www/html
- ./app/env.dev:/var/www/html/.env
./app/html has .env file. Before updating Docker Desktop, it was override .env file by ./app/env.dev. But now cannot override it.
I checked docker-compose version of both 2.4.0.0 and 2.5.0.0. Both versions are the same version 1.27.4, build 40524192.
Information
- macOS Version: 10.15.7 (19H2)
Diagnostic logs
Docker for Mac: version 2.5.0.0
Steps to reproduce the behavior
- Create base directory and .env file under the directory
$ mkdir -p app/html
$ touch app/html/.env
- create env.dev file
$ echo "TEST=TEST" > app/env.dev
- create docker-compose.yml
version: '3'
services:
app:
volumes:
- ./app/html:/var/www/html
- ./app/env.dev:/var/www/html/.env
- docker-compose up -d
$ docker-compose up -d
- connect to docker container and check file
$ docker-compose exec app ls -la /var/www/html/.env
$ docker-compose exec app cat /var/www/html/.env
Hmmm, I can't reproduce this. I'm always seeing the proper dev version of the file.
Can you reproduce it with a simple docker run -v command, without using compose?
@stephen-turner san,
Thank you for you reply.
Can you reproduce it with a simple
docker run -vcommand, without using compose?
I did it on docker-for-mac version 2.5.0.0 as the following. It looks fine.
% docker run -v $(pwd)/html:/var/www/html -v $(pwd)/env.development:/var/www/html/.env -it app /bin/bash
# ls -la /var/www/html/.env
-rw-r--r-- 1 root root 3681 Oct 20 04:58 /var/www/html/.env
When I use docker-compose on docker-for-mac version 2.5.0.0, it didn't work. Now I downgraded version 2.4.0.0 and using, it can work.
In other hand, I found the different between 2.4.0.0 and 2.5.0.0.
docker version's output
Client: Docker Engine - Community
Cloud integration 0.1.18 <=== 2.5.0.0 is 1.0.1
Version: 19.03.13
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 16:58:31 2020
OS/Arch: darwin/amd64
Experimental: false
- 2.4.0.0 : Cloud integration 0.1.18
- 2.5.0.0 : Cloud integration 1.0.1 Other versions are same.
docker-compose version's output all same
docker inspect's output 2.4.0.0 has the following parameters, but 2.5.0.0 doesn't have them. But it's only label. I'm not sure whether important or not.
[
{
"Config": {
"Labels": {
"com.docker.compose.config-hash": "9b2f5e15ff672a3bf7faf772110f0c2149e2e90e93e361120347bf909f1efe09",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "test",
"com.docker.compose.project.config_files": "docker-compose-test.yml",
"com.docker.compose.project.working_dir": "/Users/midoridge/work/docker/test",
"com.docker.compose.service": "app",
"com.docker.compose.version": "1.27.4",
"desktop.docker.io/binds/0/Source": "/Users/midoridge/work/docker/test/app",
"desktop.docker.io/binds/0/SourceKind": "hostFile",
"desktop.docker.io/binds/0/Target": "/var/www/html",
"desktop.docker.io/binds/1/Source": "/Users/midoridge/work/docker/test/app/env.dev",
"desktop.docker.io/binds/1/SourceKind": "hostFile",
"desktop.docker.io/binds/1/Target": "/var/www/html/.env"
}
},
}
]
I can confirm, with docker run -v it works as expected:
root@8d726354d0b0:/# mount | grep grpcfuse
grpcfuse on /var/www type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
grpcfuse on /var/www/.env type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
but on multiple docker for mac 2.5.0.0 installs, the composer version is not working as expected. docker inspect has all 5 mounts present in the docker-compose.yml:
{
"Type": "bind",
"Source": "/Users/user/docker/data/logs",
"Destination": "/var/logs",
"Mode": "delegated",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/Users/user/docker/config/dotenv",
"Destination": "/var/www/.env",
"Mode": "cached",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/Users/user/site",
"Destination": "/var/www",
"Mode": "cached",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/Users/user/docker/config/php.ini",
"Destination": "/usr/local/etc/php/php.ini",
"Mode": "cached",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/Users/user/docker/config/development.php",
"Destination": "/var/www/config/environments/development.php",
"Mode": "cached",
"RW": true,
"Propagation": "rprivate"
}
but mount says only the 3 "base" once are mounted
root@50e5c73acf0d:/var/www/html# mount | grep grpc
grpcfuse on /var/logs type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
grpcfuse on /var/www type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
grpcfuse on /usr/local/etc/php/php.ini type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
root@50e5c73acf0d:/var/www/html#
@noud-github are there any other changes between the docker inspect for the docker run and docker-compose up cases (perhaps in other areas, e.g. (HostConfig.Binds, HostConfig.Mounts, HostConfig.Volumes)?
Would it be possible for you to do a diff between the two variants? (OK to redact unrelated info)
was running the 2 diff, you ask, than checked for the last time if the .env was the wrong one... and it is mounted. and it suddenly works as expected....
grpcfuse on /var/www type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
grpcfuse on /var/www/.env type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
grpcfuse on /etc/nginx/conf.d/site.conf type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
grpcfuse on /var/www/config/environments/development.php type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)
main difference updated Mac to "Big Sur" second disabled gRPC FUSE (for normal running) and enabled it again for this test....
I still have the issue, let me explain: we have a compose with 5 containers. a nginx container and a "custom container", both mounting the same (almost) files. (one more on the "custom" ) first: The above comment covers the Nginx one where it now is working (thought I tested it failing two before) second: on our custom container, it is failing.
tp put is sort So I have one composer file mounting files in one container it is working as expected and on a other container the mounting basically the same files. this issue is experienced.
will do a diff on the inspect later.
(EDIT:)
While debugging an other docker issue we found that when using gRPC a docker-compose.yml
doing the same file mount into a other mount in more than one container will result in: it only works as expected in the first, and break in second etc, containers,
(EDIT2:)
in the last case we use multiple times the same container and the same file shares, only the config file is different and mounted in the share.
unfortunately running simultaneous the same docker run command does not reproduce this behavior
@noud-github Are you saying that everything is good if you only have one container in your compose file, but if you have two or more it breaks?
@midoridge Your original example only had one container, are you seeing the bug with only one container, or do you need a second container to show the bug?
I have the same issue with Docker Desktop > 2.3
It happens with multiple containers :
version: '3.4'
services:
app:
build: ./docker/symfony
volumes:
- ./source:/var/www/html
- ./docker/.env.dev:/var/www/html/.env.local
app2:
build: ./docker/symfony
volumes:
- ./source:/var/www/html
- ./docker/.env.dev:/var/www/html/.env.local
=> .env.local is empty
Otherwise with Docker Desktop 2.3.0.5 it works well
Thanks @aless673. So just to confirm, for you it only happens with multiple containers, not a single container?
Yes I can confirm that, two. only with multiple, not a single container.
OK, thanks, that's a good clue. It looks like the original report was oversimplified. We'll try again to reproduce it.
Maybe abundant but with multiple containers the issue occurs in the second and up (containers)not the first one. so keep in mind there was one GOOD container in the tests we did.
we tested with docker desktop 2.5.0.X
Hmmm, unfortunately I can't reproduce it even with two containers. Both containers' file systems have the extra file in my experiments.
Hmmm, unfortunately I can't reproduce it even with two containers. Both containers' file systems have the extra file in my experiments.
File exists but is empty
Yes, but I looked at the contents too and it has the correct contents.
It's possible that there's a race condition that I'm not triggering. That might also explain why more people haven't found this.
do jou think that condation is triggered by some thing in the compose file or some where else.
Possibly, but more likely it's just something random in the order of events. It might be worse on a fast computer, or a slow computer, or something.
@stephen-turner Sorry for late reply and mistake this comment. I revised it.
Your original example only had one container, are you seeing the bug with only one container, or do you need a second container to show the bug?
I did three containers first, it didn't work.
I am seeing this with Docker for Mac 3.0.3 with 16 containers running, when I simplify to 1 container I do not see the issue. Turning off gRPC FUSE fixes the issue.