Reputation: 16116
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
Upvotes: 5
Views: 6191
Reputation: 1651
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.
Upvotes: 8
Reputation: 454
Just Add your current user to "Local Group": 'Hyper-V Administrators'.
Check your <current username> by:
> whoami
Start cmd.exe
by Administrator:
> net localgroup
> net localgroup "Hyper-V Administrators" <current username> /add
Upvotes: 5
Reputation: 584
You can change the properties on the docker-machine executable to Run As Administrator. The file is located (at least on my box) in C:\Program Files\Docker\Docker\resources\bin\docker-machine.exe Find this file, right click and select Compatibility and check the box "Run this program as an administrator".
Upvotes: 1