Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Error with pre-create check: "Hyper-V PowerShell Module is not available" #4342

Closed
rogermartensson opened this issue Dec 19, 2017 · 19 comments
Closed
Milestone

Comments

@rogermartensson
Copy link

Version: 17.09.

Command:
docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" name1
Running pre-create checks...
Error with pre-create check: "Hyper-V PowerShell Module is not available"

I found problem in: https://github.com/docker/machine/blob/master/drivers/hyperv/powershell.go
The reason for the problem is the Check is looking for Get-VM. If you have VMware PowerCLI installed it can happen that the test will find the VMware version of the Get-VM command. And this isn't correct and will fail.

The solution is to add the modulename to the Get-VM name.

@Wicaeed
Copy link

Wicaeed commented Jan 17, 2018

Currently affected by this issue. Is there a workaround?

@cljk
Copy link

cljk commented Mar 21, 2018

Hmmm.. I´m getting the same error... but I have the PowerShell Module installed and have NO Vmware CLI installed....

Any ideas!?

@cljk
Copy link

cljk commented Mar 21, 2018

Okay... I think I´m affected from issue #4342 - differenct cause (docker for windows installed)

@capnchamomile
Copy link

Same issue here. I can run Get-VM and it will list VMs in Hyper-V but when I attempt to run docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1 I get the "Hyper-V Powershell Module is not available" error

@stean202020
Copy link

Same issue. This started happening after the upgrade from 17.x to 18.03.0-ce-win59 (16762). Get-VM is also working. Running Win 10 Pro version 1803 OS build 17128.1

docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1
Running pre-create checks...
Error with pre-create check: "Hyper-V PowerShell Module is not available"

Get-VM
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version


MobyLinuxVM Running 0 2048 02:10:08.2950000 Operating normally 8.3

@cljk
Copy link

cljk commented Mar 27, 2018

I now switched back to Virtualbox and removed Hyper-V completely. The whole network management of Hyper-V was a pain independent of the problems with docker-machine.

@oit63
Copy link

oit63 commented Apr 3, 2018

...
same error

@oit63
Copy link

oit63 commented Apr 3, 2018

I would use a hyper-v linux instead using docker directly

@sincerekamal
Copy link

I'm using docker-machine version 0.14.0, build 89b8332 in my macbook, but still I get this error, any update on fixing this issue ?

@MikyChow
Copy link

i had the same issue now,is any one can help us fix it?
image

@thangchung
Copy link

Trying to downgrade minikube to 0.25.0, and it should work.
You can find the issues at kubernetes/minikube#2634
I used Windows 10, then just simply run the command as below
choco install minikube --version 0.25.0 --allow-downgrade
Hope this helps while we're waiting for a fixed version.

@cljk
Copy link

cljk commented Apr 15, 2018

Dont know if its the same with minikube - but you cant successfully install docker with chocolatey. At least some weeks ago there was a bug in choco install routine

@ishallbethat
Copy link

is this problem fixed ? i still got the problem.

PS C:\Users\yingp>  docker-machine create --driver hyperv DC2-N1
Running pre-create checks...
Error with pre-create check: "Hyper-V PowerShell Module is not available"
PS C:\Users\yingp>

@kelvinnguyen2310
Copy link

Please read this thread #4424 (comment)
A workaround is to downgrade docker-machine to v0.13.0

Download 32-bit or 64-bit version at https://github.com/docker/machine/releases/tag/v0.13.0
Replace C:\Program Files\Docker\Docker\resources\bin\docker-machine.exe with the newly downloaded file.

@taoism-o
Copy link

@kelvinnguyen2310 Holly Fk S !!!!!! YOU!!!! SAVED!!! MY!!!! LIFE!!!!
I've been stuck here for a almost whole day!!!!! You!! Just!!! Saved!!! Me!!!!
even just been downgrade the version of the docker-machine.

@vparam
Copy link

vparam commented Jun 23, 2018

docker-machine to v0.15.0 has fixed the issue. Thanks folks

@fadyboy
Copy link

fadyboy commented Jul 3, 2018

I'm still having this issue with docker-machine v0.15.0

@webstandardcss
Copy link

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

@ShemTovYosef
Copy link

ShemTovYosef commented Jul 22, 2018

I got another error with 0.13 and 0.15
Starting VM...
Error creating machine: Error in driver during machine creation: exit status 1

Then I switched from Linux Containers to Windows containers and resolved this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests