Docker Community Forums

Share and learn in the Docker community.

[Resolved] Docker always mount empty folder


(Thibaud Lepretre) #1

Expected behavior

echo "BODY" > /tmp/test.txt
docker run -it --rm -v /tmp/test.txt:/test.txt ubuntu echo /test.txt

Expected that test.txt is a file that containing “BODY”

Same for

mkdir /tmp/a
echo "BODY" > /tmp/a/test.txt
docker run -it --rm -v /tmp/a:/a ubuntu ls -al /a

Expected that /a is containing test.txt

Actual behavior

For

echo "BODY" > /tmp/test.txt
docker run -it --rm -v /tmp/test.txt:/test.txt ubuntu echo /test.txt

test.txt is not a file but an empty folder

root@97d833edb3a5:/# ls -la / | grep test.txt
drwxr-xr-x  2 root root   40 Apr 20 08:52 test.txt
root@97d833edb3a5:/# ls -al /test.txt/
total 4
drwxr-xr-x  2 root root   40 Apr 20 08:52 ./
drwxr-xr-x 33 root root 4096 Apr 20 08:52 ..

For

mkdir /tmp/a
echo "BODY" > /tmp/a/test.txt
docker run -it --rm -v /tmp/a:/a ubuntu ls -al /a

Same always an empty folder

$ docker run -it --rm -v /tmp/a:/a ubuntu ls -al /a
total 4
drwxr-xr-x  2 root root   40 Apr 20 08:57 .
drwxr-xr-x 33 root root 4096 Apr 20 08:57 ..

Information

  • the output of:
    • pinata diagnose -u on OSX
OS X: version 10.10.5 (build: 14F27)
Docker.app: version v1.11.0-beta7
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160420-105804.tar.gz
Most specific failure is: No error was detected
Your unique id is: 0473D45E-5EF5-4790-8339-065AD0338BE5
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. echo "BODY" > /tmp/test.txt
  2. docker run -it --rm -v /tmp/test.txt:/test.txt ubuntu cat /test.txt

(Samsouk) #2

Your command is wrong,
on the 2nd line it should be cat instead of echo:

echo "BODY" > /tmp/test.txt
docker run -it --rm -v /tmp/test.txt:/test.txt ubuntu cat /test.txt

(Thibaud Lepretre) #3

Yes sorry error when reporting issue. But issue still the same docker always mount an empty folder even if I mount a file or non empty folder.

Moreover I also tried with /Mac prefix but it complains that it does not exists


(Thibaud Lepretre) #4

After new Docker for Mac update version (Version 1.11.0-beta8 (build: 6072)) the problem is now gone.


(David Sheets) #5

Hi Thibaud,

Could you please clarify, is the problem gone or still remaining?

If the issue remains, could you please run pinata diagnose -u and post the bugsnag ID here?

Thank you,

David


(Thibaud Lepretre) #6

Oups sorry for confusion, I forget the “w” on “noW”. I have no more issue since update ! I can enjoy docker mounting totally without bug.