Docker Machine error: Hyper-V PowerShell Module is not available
Asked Answered
S

5

8

I've checked my Hyper-V settings and PowerShell Module is enabled. I've also found this documented issue: https://github.com/docker/machine/issues/4342 but it is not the same issue since I do not have VMware PowerCLI installed. The issue was closed with a push to the repo and is supposedly fixed in 0.14.0-rc1, build e918c74 so I tried it anyways. After replacing my docker-machine.exe, I'm still getting the error and still getting the error even if I reinstall Docker for Windows.

For some more background, this error starting happening after a reinstall because my Docker install had an error: https://github.com/docker/for-win/issues/1691, however, I'm not longer getting that issue after reinstalling.

Sheep answered 22/3, 2018 at 6:29 Comment(0)
L
7

When creating a Hyper-v VM using docker-machine on win10, an error was returned"Error with pre-create check: "Hyper-V PowerShell Module is not available"。

The solution is very simple. The reason is the version of the docker-machine program. Replace it with v0.13.0. The detailed operation is as follows:

  1. Download the 0.13.0 version of the docker-machine command. Click to download: 32-bit system or 64-bit system

  2. After the download is complete, rename and replace the " docker-machine.exe " file in the " C:\Program Files\Docker\Docker\resources\bin" directory. It is best to back up the original file.

Laconia answered 12/6, 2018 at 18:32 Comment(2)
It seems they also fixed it in 0.15: github.com/docker/machine/releases, github.com/docker/machine/pull/4426Sheep
Before updating to 0.15, I use 0.14, the same issue as @Sheep asked. So is it a bug?Feudatory
C
9

For those who struggle with this issue in Windows, Follow the instruction here

Claudication answered 2/4, 2018 at 20:18 Comment(0)
L
7

When creating a Hyper-v VM using docker-machine on win10, an error was returned"Error with pre-create check: "Hyper-V PowerShell Module is not available"。

The solution is very simple. The reason is the version of the docker-machine program. Replace it with v0.13.0. The detailed operation is as follows:

  1. Download the 0.13.0 version of the docker-machine command. Click to download: 32-bit system or 64-bit system

  2. After the download is complete, rename and replace the " docker-machine.exe " file in the " C:\Program Files\Docker\Docker\resources\bin" directory. It is best to back up the original file.

Laconia answered 12/6, 2018 at 18:32 Comment(2)
It seems they also fixed it in 0.15: github.com/docker/machine/releases, github.com/docker/machine/pull/4426Sheep
Before updating to 0.15, I use 0.14, the same issue as @Sheep asked. So is it a bug?Feudatory
N
5

Here is the solution

https://github.com/docker/machine/releases/download/v0.15.0/docker-machine-Windows-x86_64.exe

Save the downloaded file to your existing directory containing docker-machine.exe.

For my system this is the location for docker-machine.exe /c/Program Files/Docker/Docker/Resources/bin/docker-machine.exe

Backup the old file and replace it file with the new one.

cp docker-machine.exe docker-machine.014.exe

Rename the downloaded filename to docker-machine.exe

mv docker-machine-Windows-x86_64.exe docker-machine.exe

Build Instructions

  1. Create virtual switch in Hyper-V manager named myswitch
  2. Request Docker to create a VM named myvm1

docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1

Results

docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1

Running pre-create checks... (myvm1) Image cache directory does not exist, creating it at C:\Users\Trey Brister\.docker\machine\cache... (myvm1) No default Boot2Docker ISO found locally, downloading the latest release... (myvm1) Latest release for github.com/boot2docker/boot2docker is v18.05.0-ce (myvm1) Downloading C:\Users\Trey Brister\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.05.0-ce/boot2docker.iso... (myvm1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% Creating machine... (myvm1) Copying C:\Users\Trey Brister\.docker\machine\cache\boot2docker.iso to C:\Users\Trey Brister\.docker\machine\machines\myvm1\boot2docker.iso... (myvm1) Creating SSH key... (myvm1) Creating VM... (myvm1) Using switch "myswitch" (myvm1) Creating VHD (myvm1) Starting VM... (myvm1) 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\Docker\Docker\Resources\bin\docker-machine.exe env myvm1

Nakisha answered 17/7, 2018 at 5:57 Comment(0)
M
0

(1), V0.15 fixed this issue officially: Fix issue #4424 - Pre-create check: "Hyper-V PowerShell Module is not available" Official Introduction: https://github.com/docker/machine/pull/4426 Address to donload V0.15 https://github.com/docker/machine/releases

(2), I tested this, it works fine. No need restart docker It take effect immdiately after the "docker-machine.exe" is replaced with version 0.15

(3), Backup the original one is a good habit

Maxima answered 5/7, 2018 at 8:8 Comment(0)
L
0

Just start docker desktop if you are on Windows

Lotti answered 5/9, 2022 at 3:4 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.