Creates a Boot2Docker virtual machine locally on your Windows machine using Hyper-V.
Hyper-V must be enabled on your desktop system. Docker for Windows automatically enables it upon install. See this article on the Microsoft developer network for instructions on how to manually enable Hyper-V.
You will need to use an Administrator level account to create and manage Hyper-V machines.
You will need an existing virtual switch to use the driver. Hyper-V can share an external network interface (aka bridging), see this blog. If you would like to use NAT, create an internal network, and use Internet Connection Sharing.
This reference page includes an example that shows how to use an elevated (Administrator-level) PowerShell and how to create and use an external network switch.
$ docker-machine create --driver hyperv vm
--hyperv-boot2docker-url: The URL of the boot2docker ISO.
--hyperv-virtual-switch: Name of the virtual switch to use.
--hyperv-disk-size: Size of disk for the host in MB.
--hyperv-memory: Size of memory for the host in MB.
--hyperv-cpu-count: Number of CPUs for the host.
--hyperv-static-macaddress: Hyper-V network adapter’s static MAC address.
--hyperv-vlan-id: Hyper-V network adapter’s VLAN ID if any.
|CLI option||Environment variable||Default|
| || ||Latest boot2docker url|
| || ||first found|
| || || |
| || || |
| || || |
| || ||undefined|
| || ||undefined|
Hyper-V is automatically enabled on a Docker for Windows install. To enable it manually, see instructions on how to manually enable Hyper-V on the Microsoft developer network.
Note: If you already have an external network switch you can skip this setup and use that one.
Make sure you have Ethernet connectivity while you are doing this.
Open the Hyper-V Manager. (On Windows 10, just search for the Hyper-V Manager in the search field in the lower left search field.)
Select the Virtual Switch Manager on the left-side Actions panel.
Set up a new external network switch to use instead of DockerNAT network switch (for Moby), which is set up by default when you install Docker for Windows. (Or if you already have another network switch set up, you can use that one, but it must be an external switch.)
For this example, we created a virtual switch called
Primary Virtual Switch.
A reboot of your desktop system clears out any problems with the routing tables. Without a reboot first,
docker-machine create ... might get hung up on
Waiting for VM to start.
Start an “elevated” PowerShell (i.e., running as administrator). To do this, search for PowerShell, right-click, and choose Run as administrator.
docker-machine create commands to create machines.
Use the Microsoft Hyper-V driver and reference the new virtual switch you created.
docker-machine create -d hyperv --hyperv-virtual-switch "<NameOfVirtualSwitch>" <nameOfNode>
Here is an example of creating
```shell PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" manager1 Running pre-create checks... Creating machine... (manager1) Copying C:\Users\Vicky\.docker\machine\cache\boot2docker.iso to C:\Users\Vicky\.docker\machine\machines\manag er1\boot2docker.iso... (manager1) Creating SSH key... (manager1) Creating VM... (manager1) Using switch "Primary Virtual Switch" (manager1) Creating VHD (manager1) Starting VM... (manager1) Waiting for host to start... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Checking connection to Docker... Docker is up and running! To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Doc ker\Docker\Resources\bin\docker-machine.exe env manager1 PS C:\WINDOWS\system32> ```
Use the same process, driver, and network switch to create the other nodes.
For our example, the commands will look like this:
docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" worker1 docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" worker2
© 2017 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.