Home > Software engineering >  docker-machine unable to create a machine on macOS, VBoxManage returning E_ACCESSDENIED error
docker-machine unable to create a machine on macOS, VBoxManage returning E_ACCESSDENIED error

Time:12-11

I have docker, docker-machine, and virtualbox installed using HomeBrew:

Docker version 20.10.11, build dea9396e18
docker-machine version 0.16.2, build bd45ab1
VBoxManage version 6.1.30r148432

when I try creating a new machine

docker-machine create -d virtualbox default

I get the below errors:

Running pre-create checks...
Creating machine...
(default) Copying /Users/foobar/.docker/machine/cache/boot2docker.iso to /Users/foobar/.docker/machine/machines/default/boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Found a new host-only adapter: "vboxnet0"
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: /usr/local/bin/VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp

I have tried many things

  • reinstalling all of my packages
  • running the above command in sudo
  • using the kextload as instructed here to "enable kernel extensions"
  • checking if there are any orphaned machines from past as suggested here with docker-machine ls

to no avail. Apparently the issue is caused by the IP restriction for Host-Only networks in the newer versions of VirtualBox. Some posts suggesting a manual edit of the VirtualBox's networks.conf file. But I can't find it on my machine, nor I know what I should change there!

P.S.1. Asked a follow-up question here on Reddit.

CodePudding user response:

Thanks to this comment on Reddit, I was able to figure the issue out:

  1. find all the machines with docker-machine ls
  2. remove them with docker-machine rm -y <machineName>
  3. find all the "host-only ethernet adapters" with VBoxManage list hostonlyifs
  4. Remove them one by one with VBoxManage hostonlyif remove <networkName>
  5. Create a vbox folder in the etc with sudo mkdir
  6. Create a file networks.conf in the vbox folder, for example by sudo touch
  7. place the below line there
* 0.0.0.0/0 ::/0
  1. create a new machine with docker-machine create -d virtualbox <machineName>
  2. Run the command eval $(docker-machine env <machineName>) to configure your shell

P.S.1. One major drawback of the above solution is that every time you start the docker machine with docker-machine start <machineName> It takes a lot of time on Waiting for an IP...

  • Related