Opened 9 years ago
Closed 6 years ago
#14920 closed defect (fixed)
VboxSF volumes mounted in Docker containers do not update file contents => Fixed in SVN / 6.0.6
Reported by: | doozr | Owned by: | |
---|---|---|---|
Component: | shared folders | Version: | VirtualBox 5.0.10 |
Keywords: | docker | Cc: | |
Guest type: | Linux | Host type: | Mac OS X |
Description
When using vboxsf to share a folder to a VM and that folder is mounted as a volume in a container, the contents of the files are inconsistent depending which program is used to view it. Some programs see the file contents as they were when the volume was mounted, and other see the current file contents.
List the steps to reproduce the issue:
- Mount vboxfs share as a volume in a container
- Edit a file in the volume outside the container
- Observe that some processes in the container see different content to others
Describe the results you received:
Some processes (e.g. python, cat) always see the files as if they had not been edited, but others (e.g. vi, less) always see the current version.
Describe the results you expected:
All processes see the latest version of the files.
Provide additional info you think is important:
Worked example using Docker 1.9.1
Install VirtualBox 5.0.4 and build a VM with Ubuntu 14.04 x64. This bug has also been reproduced with CentOS 7.1 on the VM. The test hosts were Mac OS X 10.11.1 El Capitan and Ubuntu 14.04.
Create a Dockerfile as follows
FROM alpine:3.2 RUN apk add --update python ENTRYPOINT ["sh", "-c"] CMD ["while true; do sleep 10; done"]
Build the image
$ docker build -t testimage .
Mount a directory via into a VirtualBox VM using vboxfs containing a single file, test.py:
print "HELLO"
$ ls /path/to/mount test.py
Run a container, mounting the shared folder:
$ docker run -d -v /path/to/mount:/files testimage a7741514db36343c7f9df7f94685555a75072e6eb3c9de72ddec983f050ec401
Exec a shell on the container and run the python script, and cat its contents:
$ docker exec -it a7741514db36 sh # cd /files # python test.py HELLO # cat test.py print "HELLO" # less test.py (contents are: print "HELLO") # vi test.py (contents are: print "HELLO")
Edit the file on the host machine, changing HELLO to GOODBYE. Then use docker exec again:
$ docker exec -it a7741514db36 sh # cd /files # python test.py HELLO # cat test.py print "HELLO" # less test.py (contents are: print "GOODBYE") # vi test.py (contents are: print "GOODBYE")
As demonstrated, the python and cat executables still see the original contents of the file, but the less and vi executables see the new contents.
One final demonstration; edit the file inside the container using vi, then execute it with python:
# vi /files/test.py (change GOODBYE to TESTING) # python /files/test.py HELLO # cat /files/test.py print "HELLO" # less /files/test.py (contents are: print "TESTING")
Python again executes the original contents of the file, and cat sees the same. Vi and less see, again, the edited files.
$ docker --version Docker version 1.9.1, build a34a1d5
Change History (3)
comment:1 by , 9 years ago
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Summary: | VboxSF volumes mounted in Docker containers do not update file contents → VboxSF volumes mounted in Docker containers do not update file contents => Fixed in SVN / 6.0.6 |
Should be fixed in 6.0.6 (if not earlier).
This looks to be the same problem as #9069