Docker Community Forums

Share and learn in the Docker community.

Directories deleted and recreated on host cause mounted volume to become disconnected

(Martinentwistle) #1

Expected behavior

If a directory is volume mounted, all changes on the host should by visible in the docker container.

Actual behavior

If a directory within the mounted volume is deleted, then re-created with the same name, docker no longer sees the directory contents and cannot write to the directory any more.


Diagnostic ID CEE8ECF6-5316-463D-B341-019235307AC5

Host MacBook Pro OSX Version 10.11.5

Steps to reproduce the behavior

  1. Volume mount a directory containing another directory e.f /Users/bob containing /temp
    e.g: docker run -d -p 2022:22 --privileged=true -v /Users/bob:/Users/bob docker-image-name
  2. Create a file in the directory to check its all working e.g. /Users/bob/temp/test.txt
  3. Navigate to this temp directory in docker and list the contents
  4. Delete the temp directory on the Host, then recreate it
  5. On the host, create another file in the directory e.g. /Users/bob/temp/another.txt
  6. List the contents of /Users/bob/temp on the docker container - now shows as an empty directory

File change notifications broken, osxfs fails silently
(Martinentwistle) #2

I collected some logs after the issue happened:

Jun 29 11:30:35 ibm-martine-mac Docker[35970] : server loop caught (Failure “Caught EOF on underlying FLOW”): no further requests will be processed
Jun 29 11:30:35 ibm-martine-mac Docker[55569] : EOF reading packet from Unix domain socket: closing
Jun 29 11:30:35 ibm-martine-mac Docker[55569] : Failed to read folder3 from client
Jun 29 11:32:05 ibm-martine-mac Docker[35969] : Volume.stop ec4b9795ec6a87717cd03e00a918f519b951807edb412f270ae0e8ca5221f850 (paths = [/Users/xxxxxx/folder1, /Users/xxxxxx/folder2])
Jun 29 11:32:15 ibm-martine-mac Docker[35971] : sending SIGTERM to com.docker.hyperkit pid 35973
Jun 29 11:32:16 ibm-martine-mac Docker[35969] : transfused: copy /Mac: error reading:
Jun 29 11:32:16 ibm-martine-mac Docker[35969] : transfused: No such device
Jun 29 11:32:16 ibm-martine-mac Docker[35969] : Fatal unexpected exception: Transfuse.Socket_closed
Jun 29 11:32:16 ibm-martine-mac Docker[717] : Reap com.docker.osxfs (pid 35969): exit status 1
Jun 29 11:32:16 ibm-martine-mac Docker[35971] : virtio-net-vpnkit: initialising, opts="uuid=6d922fbd-3438-4ee0-b29f-0ec6363c1014,path=/Users/xxxxxx/Library/Containers/com.docker.docker/Data/s50,macfile=/Users/xxxxxx/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/mac.0"
Jun 29 11:32:16 ibm-martine-mac Docker[35971] : Interface will have uuid 6d922fbd-3438-4ee0-b29f-0ec6363c1014
Jun 29 11:32:16 ibm-martine-mac Docker[35971] : Connection established with MAC=c0:ff:ee:c0:ff:ee and MTU 1500

This folder2 became unusable in the container after is was deleted and re-created (folder3 was in folder2 and was deleted with the folder2)

(Rostchri) #3

Other way to reproduce …

inside a running docker-container:
/# df
Filesystem 1K-blocks Used Available Use% Mounted on
none 61891364 2192652 56531736 4% /
tmpfs 1024196 0 1024196 0% /dev
tmpfs 1024196 0 1024196 0% /sys/fs/cgroup
shm 65536 0 65536 0% /dev/shm
/dev/vda2 61891364 2192656 56531732 4% /etc/resolv.conf
/dev/vda2 61891364 2192656 56531732 4% /etc/hostname
/dev/vda2 61891364 2192656 56531732 4% /etc/hosts
osxfs 999365024 833099872 166009152 83% /config

/ # cd /config/
/config # mkdir test
/config # mv test newtest
/config # cd newtest
/config/newtest # ls -all
total 1
drwxr-xr-x 2 root root 68 Aug 9 22:30 .
drwxr-xr-x 6 root root 204 Aug 9 22:30 …
/config/newtest # touch 1
touch: 1: No such file or directory <— BANG This should not happen. Return-code = 1 which is very bad …
/config/newtest # echo $?
/config/newtest # ls -all <— The file itself is present but the Return-code above should not be 1 …
total 1
drwxr-xr-x 4 root root 136 Aug 9 22:31 .
drwxr-xr-x 6 root root 204 Aug 9 22:30 …
-rw-r–r-- 1 root root 0 Aug 9 22:30 1

(David Sheets) #4

@rostchri The issue you report is different from that reported in the rest of this thread. You didn’t say which version of the software you are running but your issue should have been resolved in Beta 21.1 (build 11019) and will be fixed in the stable 1.12.0.a hotfix to be deployed very soon.

@martinentwistle we are actively working on fixing the directory removal while a handle is open issue that you report. Thanks for participating in the Docker for Mac Beta and thank you for your patience.

(David Sheets) #5

This should now be resolved in Beta 24.

(Martinentwistle) #6

Not had any reoccurrences since Beta 24! Thanks!


You have restarted the port agent when the volume is reconnected. In general, the container can continue to do useful work in a degraded state; the installation can be optional (for example, only one of the multiple media sources), so it is always undesirable to pause when the volume does not increase.

I thought more about my original expectations that networks should be made clearly, but now I see that the program inside the container might not handle it properly anyway, so it seems that restarting is the most powerful option. C2090-616 Dumps Questions

Since I still need a custom auto-assembly solution, adding a reboot from the sender is in good condition for me personally. However, if the car assembler ever uses encrypted credentials, having a port agent automatically reboot will be excellent.