18

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.

2
  • Not sure what's causing this problem exactly but try downgrading to VirtualBox 6.1.26 that might solve your problem. Commented Dec 8, 2021 at 21:59
  • @AffésSalem rather not to that, unless a more canonical solution is found. I am thinking if/how I can edit the networks.conf file to extend the IP range, If just could find where it is located first! Commented Dec 8, 2021 at 22:02

1 Answer 1

60

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 the ones you don't need with docker-machine rm -y <machineName>
  3. find all the "host-only ethernet adapters" with VBoxManage list hostonlyifs
  4. Remove the orphaned ones with VBoxManage hostonlyif remove <networkName>
  5. Create a vbox folder in the etc directory 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...

Sign up to request clarification or add additional context in comments.

7 Comments

@fips your welcome. It took me 4-5 nights to figure this out. frustrating!
You don't need to delete the entire machine (thankfully!). Steps 3-7 followed by docker-machine start work for me.
Docker-machine has been archived (basically deprecated). Docker no longer supports it and I wouldn't recommend using it for any new use cases. github.com/docker/machine
@BMitch you may see this page to know why I detest Docker Desktop.
Thanks! This is the right way to solve this :)
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.