Machine: Docker-machine + VirtualBox not mounting host files under Linux 4.9

Created on 19 Feb 2017  路  5Comments  路  Source: docker/machine

Description

I'm mounting host folder to docker container inside dm under Linux 4.9 Virutalbox 5.1.14, but no files are mounted. The same setup under macOS works fine.

Versions

[user@local test]$ docker --version
Docker version 1.13.1, build 092cba3727

[user@local test]$ docker-machine version
docker-machine version 0.9.0, build HEAD

[user@local test]$ uname -a
Linux local 4.9.9-1-MANJARO #1 SMP PREEMPT Thu Feb 9 23:12:06 UTC 2017 x86_64 GNU/Linux

VirtualBox Graphical User Interface Version 5.1.14 r112924

Steps to reproduce the issue:

[user@local test]$ docker-machine create --driver=virtualbox m0

[user@local test]$ docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
m0     *        virtualbox   Running   tcp://192.168.99.100:2376           v1.13.1   

[user@local test]$ ls
dir0  dir1  dir2  dir3  dir4

[user@local test]$ docker run --rm -it -v `pwd`:/data busybox sh
data/ #

Describe the results you expected:

/data # ls
dir0  dir1  dir2  dir3  dir4

Describe the results you received:

/data # ls -la
total 4
drwxr-xr-x    2 root     root            40 Feb 19 08:26 .
drwxr-xr-x   20 root     root          4096 Feb 19 08:26 ..

So, no files are mounted inside selected machine => container.

Thanks.

FYI, I've found a workaround: manually mount desired folders to machine in VM config, and reboot, but that's awkward.

Most helpful comment

This solution should work fine:

#Before launching docker-machine
export VIRTUALBOX_SHARE_FOLDER="$PWD:$PWD"

The problem resides in the fact that both the Linux host and the Docker-Machine VM use the /home directory.

All 5 comments

Same problem.

Version

pirate$ docker --version
Docker version 17.03.1-ce, build c6d412e

pirate$ docker-machine --version
docker-machine version 0.10.0 build 76ead2a6

pirate$ uname -a
Linux debian 3.16.0-4 amd64 #1 SMP Debian 3.16.39+deb8u2 (2017-03-07) x86_64 GNU/Linux

Virtualbox : Oracle VM VirtualBox Manager 4.3.36_Debian

Same

magiq@magiq:~$ docker --version
Docker version 17.03.1-ce, build c6d412e
magiq@magiq:~$ docker-machine --version
docker-machine version 0.9.0, build 15fd4c7
magiq@magiq:~$ uname -a
Linux magiq 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

This solution should work fine:

#Before launching docker-machine
export VIRTUALBOX_SHARE_FOLDER="$PWD:$PWD"

The problem resides in the fact that both the Linux host and the Docker-Machine VM use the /home directory.

@ReDeiPirati THANKS! this got me out of my stuck state. CC @mjhea0

This solution should work fine:

#Before launching docker-machine
export VIRTUALBOX_SHARE_FOLDER="$PWD:$PWD"

The problem resides in the fact that both the Linux host and the Docker-Machine VM use the /home directory.

that's just the solution to it, i spent roughly 10hrs on this bug

Was this page helpful?
0 / 5 - 0 ratings