18

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?

2
  • Are you expecting an IPv4 address specifically? Can you not use the IPv6 address?
    – JAB
    Commented Nov 2, 2016 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
    Commented Nov 3, 2016 at 9:47

9 Answers 9

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.

4
  • 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\<MY_USERNAME>> docker-machine create -d hyperv --hyperv-virtual-switch VirtualSwitch4DockerMachine fooVM. I think there may be some issues with permissions on C:\Users\<MY_USERNAME>>.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
    Commented Jan 19, 2017 at 13:25
  • This worked for me. Using an External Virtual Switch did the trick.
    – Nathan R
    Commented Dec 15, 2017 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
    Commented Sep 2, 2019 at 4:06
  • After enabling an external switch I have no access to the internet
    – Asdf11
    Commented Feb 18, 2022 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.

1
  • it works for me. using gitbash won't stuck on the step “Waiting for SSH to be available…”
    – Luk Aron
    Commented Mar 27, 2020 at 13:31
2

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.

1
  • It works for me. For me, I run docker-machine.exe in wsl2.
    – Hai Mai
    Commented Aug 27, 2020 at 17:23
2

Use the switch --native-ssh

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

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.

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.

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.

1
  • 2
    This should a comment @Gary Commented May 29, 2019 at 11:55
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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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