Docker-machine fails to build VMware machine and enable shared folders
- [x] I have tried with the latest version of my channel (Stable or Edge)
- [ ] I have submitted Diagnostics
- [ ] I have included the Diagnostics ID in this Issue
- macOS Version: 10.13.4
Expected behavior
docker-machine create --driver vmware medium should create a new docker machine using VMware and be able to run on VMware Fusion with the host filesystem mounted.
Actual behavior
Errors occur during the create at the enableSharedFolders and addSharedFolder vmware commands and the /User shared folder does not get mounted.
This causes all --mount type=bind,source=<dir>,target=<dir> options for docker run and docker-compose to fail to mount the host directories correctly, resulting in unusable containers :-(
If I ssh into the machine I can see that the hgfs driver is working because it has mounted /mnt/hgfs and /mnt/hosthome. I can also browse any of the Mac host files from these mount points.
Information
I have installed docker, docker-machine, docker-compose using Homebrew I have also manually installed the updateddocker-machine-driver-vmare` to be able to use the latest vmware drivers.
Docker for Mac: Docker version 18.05.0-ce, build f150324
docker-machine: docker-machine version 0.14.0, build 89b8332docker
VMware Fusion: VMware Fusion: Professional Version 10.1.1 (7520154)
Important output from docker-machine --debug create --driver vmware medium command:
(medium) DBG | Creating Tar key bundle…
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser directoryExistsInGuest /Users/ddix/.docker/machine/machines/medium/medium.vmx /var/lib/boot2docker
(medium) DBG | The directory exists.
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser CopyFileFromHostToGuest /Users/ddix/.docker/machine/machines/medium/medium.vmx /Users/ddix/.docker/machine/machines/medium/userdata.tar /home/docker/userdata.tar
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser runScriptInGuest /Users/ddix/.docker/machine/machines/medium/medium.vmx /bin/sh sudo sh -c “tar xvf /home/docker/userdata.tar -C /home/docker > /var/log/userdata.log 2>&1 && chown -R docker:staff /home/docker”
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser runScriptInGuest /Users/ddix/.docker/machine/machines/medium/medium.vmx /bin/sh sudo /bin/mv /home/docker/userdata.tar /var/lib/boot2docker/userdata.tar
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser enableSharedFolders /Users/ddix/.docker/machine/machines/medium/medium.vmx
(medium) DBG | Error: There was an error mounting the Shared Folders file system inside the guest operating system
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser addSharedFolder /Users/ddix/.docker/machine/machines/medium/medium.vmx Users /Users
(medium) DBG | Error: There was an error mounting the Shared Folders file system inside the guest operating system
(medium) DBG | executing: /Applications/VMware Fusion.app/Contents/Public/vmrun -gu docker -gp tcuser runScriptInGuest /Users/ddix/.docker/machine/machines/medium/medium.vmx /bin/sh [ ! -d /hosthome ]&& sudo mkdir /hosthome; sudo mount --bind /mnt/hgfs//hosthome /hosthome || [ -f /usr/local/bin/vmhgfs-fuse ]&& sudo /usr/local/bin/vmhgfs-fuse -o allow_other .host:/Users /hosthome || sudo mount -t vmhgfs -o uid=$(id -u),gid=$(id -g) .host:/Users /hosthome
Steps to reproduce the behavior
-
docker-machine --debug create --driver vmware medium -
docker-machine ssh medium -
/mnt/hgfs&/hosthomeare mounted and usable, but/Usershas not mounted. -
docker run -v /Users/dave/Documents:/home/test -it --rm --name test debianresults in:
root@d06d3b217711:/# mount
none on / type aufs (rw,relatime,si=8d4a4875e8905ef9,dio,dirperm1)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (ro,nosuid,nodev,noexec,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
**tmpfs on /home/test type tmpfs (rw,relatime,size=917516k)**
/dev/sda1 on /etc/resolv.conf type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /etc/hostname type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /etc/hosts type ext4 (rw,relatime,data=ordered)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
proc on /proc/bus type proc (ro,relatime)
proc on /proc/fs type proc (ro,relatime)
proc on /proc/irq type proc (ro,relatime)
proc on /proc/sys type proc (ro,relatime)
proc on /proc/sysrq-trigger type proc (ro,relatime)
tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/timer_stats type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/scsi type tmpfs (ro,relatime)
tmpfs on /sys/firmware type tmpfs (ro,relatime)
root@d06d3b217711:/# ls -l /home/test
total 0
root@d06d3b217711:/#
Note that /home/test has been created as a tempfs mount and has no files in it.
I have also found that if I build a machine using the 1.8.2 image of boot2docker.iso and the builtin vmwarefusion driver (e.g. docker-machine create --driver vmwarefusion --vmwarefusion-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.8.2/boot2docker.iso medium) I get the right mount points and I am able to bind volumes using docker run commands without any issues, but the sebp/elk container that I want to use requires a boot2docker.iso of 1.9.0 or later, so I cannot use that image :-(
Any boot2docker version later than 1.8.2 has the newer 10.x vmtools and the problem seems to be related to this.
FYI I also have an old machine that I upgraded when installing the latest versions of docker and even though this is running the latest boot2docker.iso it still mounts host directories and binds volumes correctly. I can't use this for my sebp/elk container either as it does not have enough memory, disk or cpu's to run the ELK stack I need :-(
have you made any progress on resolving this? i have the same problem and have been working around it using this: https://github.com/adlogix/docker-machine-nfs
Problem stems from #4297 and changes to fusion_darwin.go on lines 385-387 and 403-405 (err-Checking)
Once removed, a VMware Fusion VM is created without problems. Shared folders are created, VM is usable.
Question still is, why Fusion 11 is returning errors and why the runScriptInGuest after that still creates the shares.
Any news on this? will #4297 be reverted/reassessed?
Removing the error checking added in #4297 fixed the problem for me as well. Thank you so much @logopk!
(I don't know if this helps anyone, but I've attached the exact diff I used which fixed it.)