11

I just installed docker and tried to create a Windows (not Linux) docker machine but it failed?

PS C:\> docker-machine.exe create --driver hyperv default
Creating CA: C:\Users\...\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\...\.docker\machine\certs\cert.pem
Running pre-create checks...
Error with pre-create check: "Hyper-V PowerShell Module is not available"

I downloaded the newer version of docker-machine (https://github.com/docker/machine/releases/tag/v0.15.0) and a new error occurred.

PS C:\> .\bin\docker-machine-Windows-x86_64.exe create --driver hyperv default
Running pre-create checks...
Error with pre-create check: "no External vswitch found. A valid vswitch must be available for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/"
ca9163d9
  • 27,283
  • 64
  • 210
  • 413

5 Answers5

14

I had the same problem with the message:

Error with pre-create check: "vswitch \"My Internal Switch\" not found"

I solved the problem by opening my Hyper-V Manager and creating my Virtual Switch in the GUI.

Hyper-V Virtual Switch

Running my same command in the command line then succeeded.

Kris Wheeler
  • 279
  • 4
  • 8
10

I believe that you need to create a network switch in Hyper-V Manager and specify it when you create the machine.

For example, if you create an external switch called external-switch then you can specify it like so when you create your machine.

docker-machine create --driver hyperv --hyperv-virtual-switch external-switch [Machine Name]

See this link for more information: https://docs.docker.com/machine/drivers/hyper-v

Community
  • 1
  • 1
Nimblejoe
  • 1,219
  • 2
  • 12
  • 15
  • 1
    Worked for me.This blog helped me too : https://rominirani.com/docker-machine-windows-10-hyper-v-troubleshooting-tips-367c1ea73c24 – Karbos 538 Mar 06 '19 at 13:02
7

When you run a command like the following to create a docker machine,

docker-machine create --driver hyperv hypervdockermachine

you may end up with the following error.

Error with pre-create check: "no External vswitch found. A valid vswitch must be available for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/"

Take the following steps for creating the docker machine on windows 10.

Type hyper v on windows search and fire up the Hyper-V Manager

Hyper V Manager on Windows 10

Next click Virtual Switch Manager. Create a new external virtual switch

New Virtual Switch

Crate a new virtual switch

enter details for the new virtual switch

Now run the following command.

docker-machine create --driver hyperv --hyperv-virtual-switch docker-machine-external-switch hypervdockermachine

Note that docker-machine-external-switch is the hyperv-virtual-switch that you just created and hypervdockermachine is the name of the docker-machine that are about to create with the above command

VivekDev
  • 20,868
  • 27
  • 132
  • 202
2

Default Switch is what you need!

docker-machine create --driver hyperv --hyperv-virtual-switch "Default Switch" node1

XouDo
  • 945
  • 10
  • 19
LuckyBlakc
  • 31
  • 4
  • What is "Default Switch" and how is it better than the other existing answers? – XouDo Jul 12 '21 at 13:07
  • ...the fact is that I came here precisely on the question asked. And the point of the question is how to create a virtual machine, and not how to configure hyperv. At first I was led to the first answers, that is why I wasted a lot of time until I tried everything... And I got what I need and what is in the question, simply by setting the network that was already there... – LuckyBlakc Jul 12 '21 at 19:13
  • Actually this helped me! Dont forget to run this commadn in Git Bash and not in PowerShell, since there are some bash scripts in the background whcih will fail otherwise. – Asdf11 Feb 21 '22 at 14:53
  • "command not found" – likejudo Apr 01 '22 at 21:29
0

I solved my error by moving my virtual switch from internal network to external network. Not sure why it gives that error on internal:

enter image description here

dustytrash
  • 1,568
  • 1
  • 10
  • 17