17

I'm using a docker with Windows and Hyper-v to create containers. I've added a docker machine vmachine to my docker configuration. First time the machine is created, it gets an IP (although I cannot manage nginx to access it - ERR_CONNECTION_REFUSED) and finishes the bootup.

When I turn off the machine and then try to boot it, i get stuck in this message

Waiting for SSH to be available...

And it doesn't evolve from there. The machine is booted, however, I get an IPv6 when I input the command docker-machine ip vmachine like - fe80::215:5dff:fe21:10b insted of a IPv4

What am I doing wrong?

João Dias
  • 1,078
  • 1
  • 15
  • 38
  • Are you expecting an IPv4 address specifically? Can you not use the IPv6 address? – JAB Nov 02 '16 at 23:42
  • Although I find it easier to use IPv4, that's not the issue, but a consequence... The issue is that it stucks in **Waiting for SSH to be available...** – João Dias Nov 03 '16 at 09:47

9 Answers9

10

Problem here is by default docker uses DockerNAT network switch. You should create a new external network switch instead. This issue is covered here and here. You can create an external network switch using the below command

docker-machine create -d hyperv --hyperv-virtual-switch external-switch tempbox1

or you can create one through the UI

external network switch

Be sure to reboot the device after creating the external switch.

Penkey Suresh
  • 5,816
  • 3
  • 36
  • 55
  • 2
    This did not work for me on Windows 10 and `docker-machine.exe version 0.8.2, build e18a919`. On the Hyper-V Manager UI I created that external virtual switch, then I rebooted the PC, then on a PowerShell with administrative priviledges I typed `PS C:\Users\> docker-machine create -d hyperv --hyperv-virtual-switch VirtualSwitch4DockerMachine fooVM`. I think there may be some issues with permissions on `C:\Users\>.ssh/id_rsa` (on cygwin `ls -la` gives for `id_rsa`: `Administrators Domain Users`), but I don't see any other attempt I could perform. – TPPZ Jan 19 '17 at 13:25
  • This worked for me. Using an External Virtual Switch did the trick. – Nathan R Dec 15 '17 at 17:32
  • 1
    This happened to me after a Windows 10 feature upgrade. Suddenly, my hyper-v VMs used by docker-machine were in the weeds. I had to end up deleting my existing virtual (external) switch, and recreate it, and reattach it to the VMs. – Phillip Sep 02 '19 at 04:06
  • After enabling an external switch I have no access to the internet – Asdf11 Feb 18 '22 at 15:10
4

I had a similar issue and non of the solutions worked. Turns out that according to this answer, docker launches SSH with Unix specific elements. This is said to have been fixed in the releases that followed, but I still encountered the 'Waiting for SSH' issue. I resolved this by simply using GIT bash to run all docker related SSH commands.

Dave Howson
  • 156
  • 6
  • 14
2

Use the switch --native-ssh

for example docker-machine --native-ssh .... Get more details from here

craftsmannadeem
  • 2,665
  • 26
  • 22
1

docker-machine.exe -debug create --driver hyperv --hyperv-virtual-switch "External Virtual Switch" --hyperv-cpu-count "1" --hyperv-memory "1024" --hyperv-disk-size "20000" mydockervm

make sure to have additional VirtualSwitch configure , with external network driver selected , Uninstall virtualbox

Use the debug switch to see the exact error , for me it was not able to allocate memory.

Subrata Fouzdar
  • 724
  • 5
  • 17
1

Here's what's solved it for me.

Turns out Windows 10 starting version 1709 has a built in SSH client at C:\Windows\System32\OpenSSH. Here's an article discussing it.

Looks like docker is using that SSH implementation and it's not compatible. I didn't look for a proper way to remove the built-in SSH implementatino in Windows 10, and simply renamed the folder. That was enough to fix it for me.

Alon Catz
  • 2,417
  • 1
  • 19
  • 23
0

After doing what is mentioned in the above suggestions and if you are running docker on a windows machine try to login using cli. This has worked for me.

raj240
  • 646
  • 7
  • 17
0

If you are using Command Promt Docker will stuck at Waiting for SSH to be available..., So change to use GIT BASH as @Dave Howson said it will work.

0

If you're using oracle VM you must ensure first that your new cloud vm is running.

Before: enter image description here

After: enter image description here

adhg
  • 10,437
  • 12
  • 58
  • 94
0

I had a similar problem on Windows 10 and Docker Desktop. I did the following steps which helped solve the problem:

  1. docker-compose down --remove-orphans
  2. docker system prune -f
  3. Stop Docker Desktopk, kill in the Windows task manager all running docker services
  4. Restart Docker desktop

And everything worked well.

pittnerf
  • 739
  • 1
  • 6
  • 17