Docker Community Forums

Share and learn in the Docker community.

Mounting a host's tmpfs folder inside a container does not seem to work properly in 1.10.2


(Pmrocha) #1

So, I’m having a weird issue with docker 1.10.2 (not with 1.9.1):

$ mkdir /tmp/tmp
$ touch /tmp/tmp/somefile.txt
$ docker run -v /tmp/tmp:/tmp/tmp -it debian:jessie
root@xxx:/# ls -la /tmp/tmp
total 4
drwxr-xr-x 2 root root 40 Mar 8 15:14 .
drwxrwxrwt 3 root root 4096 Mar 8 15:22 …

Or:

$ sudo mount -t tmpfs -o size=512m tmpfs $HOME/tmpfs
$ touch $HOME/tmpfs/someotherfile
$ docker run -v $HOME/tmpfs:/mnt/tmp -it debian:jessie
root@xxx:/# ls -la /mnt/tmp
total 8
drwxr-xr-x 2 1000 users 4096 Mar 8 15:48 .
drwxrwxrwt 3 root root 4096 Mar 8 15:52 …

Apparently, it does not matter where I mount it, as long as it is a tmpfs filesystem.
I first noticed this while trying to run X apps using “-v /tmp/.X11-unix:/tmp/.X11-unix”.

In 1.9.1 it works fine, but I find it hard to believe this is a general 1.10 issue and no one noticed (at least not that I could find) - do I need to do anything different for this to work now??

I am running manjaro (testing branch), kernel 4.4.4-1.

Thanks in advance,
Pedro


(Pmrocha) #2

Can someone please let me know if they have the same problem or not?

Thanks


(Skamander) #3

Hi Pedro,

I have the same problem you describe (reproducible with your second example). Not only with hosting tmpfs mounts from the host into the container (I only tried this after reading your problem while searching for a problem I have), but also by mounting with the --tmpfs flag that was introduced in docker 1.10.

EDIT: using Docker 1.11.0, build 4dc5990, running inside a ubuntu vm (using Virtualbox 5.0.18) without mounts from the host into the vm. I tried this also with a Fedora 23 and Manjaro VM - with the same problem happening. Also tried multiple docker images (ubuntu, alpine).

EDIT 2: ok, regarding the --tmpfs flag I mentioned, the feature of copying up the contents of the underlying directory was removed: https://github.com/docker/docker/pull/20501


(Tangcunren) #4

Hi pmrocha
I met the same problem when I try to integrate the golang IDE into docker-dev images.
since if there is no /tmp/.X11-unit dir, the X windows will not work.
I can’t find the solution, but I found that there is some discussion regarding LXC container mount problem, as below
https://lists.linuxcontainers.org/pipermail/lxc-users/2015-February/008468.html
which maybe is the cause, but I don’t know how to proceed as the post indicated.
anyway, there is one workaround is to umount the tmp inside the container.
then you can see the /tmp/.X11-unix appear.

so there must be someone mount the tmp fs again after docker mount the /tmp/.X11-unix