Search code examples
dockerdocker-machine

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


Solution

  • 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.