WSL(Ubuntu), Docker and Hyper-v virtualization, failed to create VM

Hi All,

This situation is very peculiar and hard to explain.
I am trying to cover this part Deploy to Swarm | Docker Docs .

My Setup :

Windows WSL (ubuntu)
Hyper-V virtulization: to create clusters

Trying to run(in ubuntu wsl):

docker-machine create -d hyperv --hyperv-virtual-switch “myswitch” myvm1

which runs successfully (actually a powershell command), if WSL started as an administrator(also added path of powershell in ubuntu wsl path variable).
But fails at creating VHD.

Error:

docker-machine create -d hyperv --hyperv-virtual-switch “myswitch” myvm2

Running pre-create checks…
(myvm2) Image cache directory does not exist, creating it at /home/ubuntu2993/.docker/machine/cache…
(myvm2) No default Boot2Docker ISO found locally, downloading the latest release…
(myvm2) Latest release for GitHub - boot2docker/boot2docker: DEPRECATED; see https://github.com/boot2docker/boot2docker/pull/1408 is v18.09.3
(myvm2) Downloading /home/ubuntu2993/.docker/machine/cache/boot2docker.iso from
(myvm2) 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
Creating machine…
(myvm2) Copying /home/ubuntu2993/.docker/machine/cache/boot2docker.iso to /home/ubuntu2993/.docker/machine/machines/myvm2/boot2docker.iso…
(myvm2) Creating SSH key…
(myvm2) Creating VM…
(myvm2) Using switch “myswitch”
(myvm2) Creating VHD
Error creating machine: Error in driver during machine creation: open /home/ubuntu2993/.docker/machine/machines/myvm2/fixed.vhd: no such file or directory

The above command works successfully on windows powershell directly.

Please help :slight_smile:

PS: I have found the workaround for this, which works, which involves running the command on powershell and copy the contents to my ubuntu user location and change path in the config.json.(But workaround is bit of a hassle, so wanted to avoid this ).

1 Like