Ticket #14920 (new defect)

Opened 23 months ago

Last modified 18 months ago

VboxSF volumes mounted in Docker containers do not update file contents

Reported by: doozr Owned by:
Priority: major Component: shared folders
Version: VirtualBox 5.0.10 Keywords: docker
Cc: Guest type: Linux
Host type: Mac OS X


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:

  1. Mount vboxfs share as a volume in a container
  2. Edit a file in the volume outside the container
  3. 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,

print "HELLO"
$ ls /path/to/mount

Run a container, mounting the shared folder:

$ docker run -d -v /path/to/mount:/files testimage

Exec a shell on the container and run the python script, and cat its contents:

$ docker exec -it a7741514db36 sh
# cd /files
# python
# cat
print "HELLO"
# less
(contents are: print "HELLO")
# vi
(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
# cat
print "HELLO"
# less
(contents are: print "GOODBYE")
# vi
(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/
# python /files/
# cat /files/
print "HELLO"
# less /files/
(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

comment:1 Changed 23 months ago by doozr

This looks to be the same problem as #9069

comment:2 Changed 18 months ago by bronek

Related: #819, #12597, #14920

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use