3

Been struggling to get this resolved for several days now.

Trying to implement a WSL and VirtualBox setup on Windows 10 Pro. The reasons aren't relevant to the issue, but using Hyper-V isn't an option. Trying to implement per:

https://www.paraesthesia.com/archive/2018/09/20/docker-on-wsl-with-virtualbox-and-docker-machine/

Whether I use Docker Toolbox or just docker-machine, the results are invariably the same. "Running as Administrator" just creates the VMs under the admin account which I don't want either. Tried rm and recreating the VMs a few dozen times.

Basically whether creating a new machine, or trying to start one, I get this error:

(default) Waiting for an IP...

Error creating machine: Error in driver during machine creation: Too many retries waiting for SSH to be available. Last error: Maximum number of retries (60) exceeded

It still creates the machine but state is timeout:

NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER   ERRORS
default            virtualbox   Timeout

I do a docker-machine env default and get the following:

Error checking TLS connection: ssh command error:
command : ip addr show
err     : exit status 255
output  :

The VM does show up in VirtualBox and has the same network adapter as my other working VMs (in that they can connect to the internet) with the exception of "Adapter 2". That is not on my other VMs:

enter image description here

The Docker VM has the following in terminal:

enter image description here enter image description here

In addition, I have gone through the following suggestions and nothing has resolved the issue. The solutions generally involve recreating the VM.

Also, my host is at 192.168.1.x on the network.

https://github.com/docker/toolbox/issues/457

https://stackoverflow.com/questions/35958619/docker-terminal-waiting-for-an-ip

https://github.com/docker/machine/issues/3268

https://github.com/docker/machine/issues/4053

UPDATES:

The VBoxManager.exe and the docker-machine.exe are in the same directory.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

2

TL;DR "Waiting for an IP" is shown when docker-machine wants to connect the guest machine from host. Possible causes: host-only network is blocked in Firewall, DHCP disabled, wrong IPv4 configuration etc.

  • Requirements:

    • Intel VT-x enabled in BIOS
    • Windows 10 64 bit with latest Ubuntu (or other GNU/Linux distribution) installed in WSL
    • VirtualBox 64 bit installed and Hyper-V disabled
    • Docker Machine 64 bit for Windows (file name docker-machine-Windows-x86_64.exe)
    • Preliminary knowledge about networking and docker machine
  • Environments:

    • VirualBox Guest (also Docker host): boot2docker lightweight GNU/Linux image for Docker
    • VirtualBox Host: Windows 10 64 bit
    • Docker Client: docker-ce in Ubuntu WSL
    • Used IPv4 range in Host-Only interface: From 192.168.99.0 to 192.168.99.255 i.e. 192.168.99.0/24 with DHCP enabled. You may change this as you want but DHCP is important for Docker Machine

I followed the article link provided in the question. Install docker-ce client in Ubuntu WSL with these following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install docker-ce
docker run hello-world
# you’ll get a message like this:
# docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

Now come back to Windows 10 host machine. Follow these step respectively:

  • Download Docker Machine 64 bit for Windows. Copy docker-machine-Windows-x86_64.exe file in VirtualBox installation folder or add VBOX_INSTALL_PATH environment variable so that docker machine executable can find VBoxManage.exe.

  • Add Host-Only virtual interface from VirtualBox Manager window. Then set up all the required IPv4 configurations in that window or from network control panel ncpa.cpl. Any private IPv4 addresses can be used. Here are the screenshots:

  • In Network Control Panel:

ipv4-network-control-panel

  • In VirtualBox Manager Window:

host-only-network-configuration

  • Allow 192.168.99.0/24 IPv4 range for both inbound and outbound connections in Windows Firewall. Also allow VBoxHeadless.exe in Windows Firewall for NTP connection in guest OS. Then run this command to create docker-host virtual OS in VitualBox with this command: docker-machine.exe create docker-host, it will install and configure VM guest OS.

  • Run docker-machine.exe env docker-host command to show configured environments. Copy those environments in WSL world or copy in .bash_profile file as following (variables will change):

# These are example. Don't copy and paste.
export DOCKER_HOST=192.168.99.104:2376
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=/mnt/c/users/username/.docker/machine/machines/docker-host
export DOCKER_MACHINE_NAME=docker-host
export COMPOSE_CONVERT_WINDOWS_PATHS=true

In WSL Ubuntu try docker run hello-world. Use docker-machine.exe stop docker-host to stop the boot2docker VM. If Windows Firewall is blocking network connections then allow VirtualBox.exe, VirtualBoxVM.exe and VBoxHeadless.exe in Windows Firewall outbound rules. Also allow the host-only network IPv4 addresses with these following commands:

New-NetFirewallRule -DisplayName "Host_Only_Network" -Name "Host_Only_Network_In" -Direction Inbound -RemoteAddress 192.168.99.0/24 -Action Allow
New-NetFirewallRule -DisplayName "Host_Only_Network" -Name "Host_Only_Network_Out" -Direction Outbound -RemoteAddress 192.168.99.0/24 -Action Allow

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.