Description
openedon Feb 5, 2020
- I have tried with the latest version of my channel (Stable or Edge)
- I have uploaded Diagnostics
- Diagnostics ID: 6E8A26E4-888A-421E-85DC-5D0CC352DA0E/20200205103309
Expected behavior
File change events from editing in the host should propagate to the container to enable tools like modd
, nodemon
or webpack
to re-compile files in-container.
Actual behavior
Changes generally trigger recompilation but under the scenario of a subdirectory of a mount also being mounted on another container, change events stop propagating (in the example I outline below, it happens after about 20 seconds). Once that happens only re-starting the container works to restore desired behaviour (for a few seconds more).
Information
Reproducible. Only happens when /dir
is mounted in one container and /dir/subdir
is mounted in another. Both mounts exhibit the same behaviour.
After more investigation, I've seen that the order in which the containers start is relevant. I can reproduce it consistently when the container mounting the top-level directory starts after the one mounting the subdirectory.
I can reproduce in the official 2.2.0.42247 release as well as the private build (2.2.0.1.42579) that tries to address issues with the new bind mount implementation (from #5532, #5540). Interestingly, the contents of the file in the container reflect what I expect, but not the events that fire.
- Windows Version: Microsoft Windows 10 Pro 10.0.18362 (Build 18362)
- Docker Desktop Version: 2.2.0.42247 and 2.2.0.1.42579
- Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No
Steps to reproduce the behavior
Using git-bash shell
mkdir -p dir/subdir
touch dir/one.txt dir/subdir/two.txt
- Use the following docker-compose.yml:
version: "3"
services:
dir:
image: alpine:latest
volumes:
- ./dir:/dir
working_dir: /dir
command: sh -c "apk add inotify-tools && inotifywait -m one.txt"
depends_on:
- 'subdir'
subdir:
image: alpine:latest
volumes:
- ./dir/subdir:/subdir
working_dir: /subdir
command: sh -c "apk add inotify-tools && inotifywait -m two.txt"
docker-compose up
- [another shell]
I=0; while true; do I=$(( $I + 1 )); echo "Change $I!" | tee -a dir/one.txt; sleep 10; done
- Watch as the events in the log come in for a while in tandem with the
Change n!
lines in the other shell, and then stop. docker-compose exec dir tail -1 one.txt
reveals all lines are there.