Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker-machine create: Error with pre-create check: "Hyper-v commands have to be run as an Administrator"

I try to create a docker-machine with docker for Windows 10 using next command:

docker-machine create --driver hyperv default

But I get the next error

Error with pre-create check: "Hyper-v commands have to be run as an Administrator"

Anyone knows how to fix this issue? Thanks

like image 809
Pau Avatar asked Aug 09 '16 11:08

Pau


2 Answers

Simply start cmd (terminal) as admin.

Otherwise, if this does not work: there is a known issue #2989 in docker machine: the creation of a Docker machine fails with the error message "Hyper-v commands have to be run as an Administrator", even if your user is member of the Hyper-V Administrator group and the Hyper-V Administrators have full access to the folder containing the VM:

λ Get-Acl E:\docker\ | Format-List ... Access : BUILTIN\Hyper-V Administrators Allow FullControl

jtnord has found a workaround by creating a VM with fixed-size disk. He has tested this for users that are group members of Hyper-V Administrators and he has given FullControl for the base Folder for Hyper-V Administrators, as I understand it.

like image 80
Olli Avatar answered Oct 08 '22 17:10

Olli


Just Add your current user to "Local Group": 'Hyper-V Administrators'.

Check your <current username> by:

> whoami

Start cmd.exe by Administrator:

  1. Check localgroup by: > net localgroup
  2. Add to Hyper-V Admininstrators: > net localgroup "Hyper-V Administrators" <current username> /add
  3. Sign out or Reboot
like image 30
Whoiskp Avatar answered Oct 08 '22 19:10

Whoiskp