Hi,
I have installed docker-machine Version: 0.9.0-rc2, build 7b19591 on Windows 10 x64. I have VirtualBox 5.1.10 r112026. I tried to use the new --virtualbox-share-folder switch.
I try the following call:
docker-machine create -d virtualbox --virtualbox-no-share --virtualbox-share-folder c:\\workspace:workspace default
I expect it to mount the specified directory on /workspace. However, nothing is mounted and nothing is available in shared folders in VirtualBox GUI.
I have also tried the Windows directory path in different formats, e.g.:
How to use the switch in Windows?
See if you can get it to work without --virtualbox-no-share
. That flag will skip the parts of Create
used to set up the share.
It does not work either. Tried with all the c:/workspace path formats as above. The effect was that nothing was mounted in all cases (neither c:users or c:workspace).
If the flag --virtualbox-no-share skips setting up the share then I would like to propose to fix the docs - https://github.com/docker/docker.github.io/blob/master/machine/drivers/virtualbox.md - because I did earlier exactly as in the docs: I used -virtualbox-no-share to "disable the mount of your home directory" (as I wanted to mount another directory).
It does not work either. Tried with all the c:/workspace path formats as above
Can you please https://gist.github.com the output (with docker-machine --debug
) of at least one such attempt?
Can you show for:
$ docker-machine create -d virtualbox --virtualbox-no-share --virtualbox-share-folder "c:\\workspace:workspace" default
Note the quotes. For this, that, or the other reason (I'm assuming automatic path translation) the above output seems to feel that the specified share dir does not exist.
For the call given above:
https://gist.github.com/michzimny/ebef21474f3c061dd59358866d2ee743
And for the same but without --virtualbox-no-share:
https://gist.github.com/michzimny/2b7c6226b59d69e3cc4e60caa8f055ad
What shell are you using? If you try it with Powershell or cmd.exe do you get different result?
btw --virtualbox-no-share
should not ever be needed for this case.
I use Cygwin. I tried now with Powershell, but is does not work either.
@nathanleclaire, another issue I noticed is that the main partition is in tmpfs. So, the /dev/sda1 is not properly mounted to /. Is it expected? Are the problems somehow related?
# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 896.2M 179.0M 717.1M 20% /
tmpfs 497.9M 8.0K 497.9M 0% /dev/shm
/dev/sda1 17.9G 1.1G 15.8G 7% /mnt/sda1
cgroup 497.9M 0 497.9M 0% /sys/fs/cgroup
workspace 465.3G 117.1G 348.2G 25% /workspace
/dev/sda1 17.9G 1.1G 15.8G 7% /mnt/sda1/var/lib/docker/aufs
none 17.9G 1.1G 15.8G 7% /mnt/sda1/var/lib/docker/aufs/mnt/3c4f13d8c296191d5c705c39c3fb85447538e522c5b3a7d731ce84324df22b10
@michzimny That seems normal to me. The root FS in boot2docker is deliberately reset on reboot (mounted only as tmpfs like you notice) and only the relevant Docker directories are mounted as persistent partitions (based on /dev/sda
device):
docker@default:~$ sudo ls -lah /var/lib/docker
lrwxrwxrwx 1 root root 24 Dec 14 21:46 /var/lib/docker -> /mnt/sda1/var/lib/docker
docker@default:~$ mount | grep docker
/dev/sda1 on /mnt/sda1/var/lib/docker/aufs type ext4 (rw,relatime,data=ordered)
As documented here https://docs.docker.com/machine/drivers/virtualbox/
The option --virtualbox-share-folder
is delimited by ':'.
So a value like this 'should' work --virtualbox-share-folder /c:c
But I guess when ran from MINGW64, the '/c' is not expanded out correctly, and the code
here skips processing it as 'os.IsNotExist' returns true.
And due to ':' being used as a delimiter, when on Windows, if not running from a linux shell, then sharedFolder cannot contain a colon, e.g. 'c:'
In the meantime, you can get it working using VBoxManage from the Docker Quickstart Terminal:
Here I'm sharing the root c: drive as '/c' from MINGW64 into the docker-machine VM using:
VBoxManage sharedfolder add default --name c --hostpath /c --automount
For reference,
The parsing code is here
split := strings.Split(d.ShareFolder, ":")
shareDir, shareName = split[0], split[1]
Also curiously , the default value that is used for 'c:Users' is "\\?\c:\Users"
See here
@rooneyp1976 Maybe that block of code you link should run https://golang.org/pkg/path/filepath/#FromSlash on it first. To be honest it's tough to say what the right expected behavior should be since the various Windows shells treat this differently.
Perhaps the author of the new option could comment? @u-foka would you have any ideas how come when using VBoxManage on MINGW64, the passing of '/c' gets expanded out to 'c:/' in VirtualBox SharedFolders but doesn't happen with docker-machine/GoLang and --virtualbox-share-folder?
The below command ran on MINGW64 gives a Shared Folder Path of 'c:/'
VBoxManage sharedfolder add default --name c --hostpath /c --automount
Note: my MINGW64 came from git version 2.10.2.windows.1
Hello, I'm running Docker Toolbox for Windows (Windows 7) and running into similar mount volume issues.
docker-machine.exe version 0.10.0
Docker version 17.04.0-ce
docker-machine --debug create -d virtualbox --virtualbox-no-share --virtualbox-share-folder "c:\\users\\installer\\iad:iad" test2
VirtualBox Version 5.1.18 r114002 (Qt5.6.2)
I'm not able to see the "iad" folder mounted when I ssh into the test2 docker machine
Filesystem Size Used Available Use% Mounted on
tmpfs 896.2M 183.6M 712.6M 20% /
tmpfs 497.9M 0 497.9M 0% /dev/shm
/dev/sda1 17.9G 44.6M 16.9G 0% /mnt/sda1
cgroup 497.9M 0 497.9M 0% /sys/fs/cgroup
/dev/sda1 17.9G 44.6M 16.9G 0% /mnt/sda1/var/lib/docker/aufs
One other thing to point out is: when I ssh into the docker machine, it shows a different docker version
Docker version 17.05.0-ce,
I was able to get this working:
docker-machine --debug create -d virtualbox --virtualbox-share-folder "\\?\c:\Program Files\installer:installdir" test2
I have no problems mounting local directories after I followed tips 3 and 4 here, where I mapped my whole drive D to /d inside the default docker VM.
After that, I can issue docker commands from my git-bash
shell on windows adding an extra leading "/" to the local paths I want to mount in order to avoid auto-conversion of paths:
docker run -it --rm -v /$(pwd):/source debian:jessie bash
or
docker run -it --rm -v //d/my/local/source:/source debian:jessie bash
Edit:
Just in case, the same syntax also works from a regular windows cmd
(remember to follow docker-machine env default
instructions in the shell before issuing docker commands).
Windows 7 box here with:
docker-machine version 0.12.2, build 9371605
Docker version 17.07.0-ce, build 8784753
Maybe the "//" syntax can help out in the case of docker-machine create --virtualbox-share-folder
?
try a setting as below.
docker-machine create --driver virtualbox --virtualbox-share-folder "c:\project:project" default
the result is...
This is how the default shared folder is stored in the VirtualBox image file (_default.vbox_) :
<SharedFolders>
<SharedFolder name="c/Users" hostPath="\\?\c:\Users" writable="true" autoMount="true"/>
</SharedFolders>
I could make it work with Windows and boot2docker 17.12.0-ce
I found a trace in _VBox.log_ after docker-machine create -d "virtualbox" ... --virtualbox-share-folder "\\?\d:\Dev\Docker\.docker\machine\SharedFolders\docker-dev-test:host-shared" docker-dev-test
:
00:00:00.949442 SharedFolders host service: Adding host mapping
00:00:00.949460 Host path '\?d:DevDocker.dockermachineSharedFoldersdocker-dev-test', map name 'host-shared', writable, automount=true, create_symlinks=true, missing=false
And docker-machine ssh docker-dev-test
then mount
says :
host-shared on /host-shared type vboxsf (rw,nodev,relatime)
This worked for me:
$ dm --version
docker-machine.exe version 0.15.0, build b48dc28d
$ docker-machine create -d virtualbox --virtualbox-share-folder "e:\\:/e" default
Running pre-create checks...
Creating machine...
(default) Copying E:\VMs\Docker\cache\boot2docker.iso to E:\VMs\Docker\machines\default\boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe env default
$ _