Reputation: 14008
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
sudo
kextload
as instructed here to "enable kernel extensions"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.
Upvotes: 18
Views: 11985
Reputation: 14008
Thanks to this comment on Reddit, I was able to figure the issue out:
docker-machine ls
docker-machine rm -y <machineName>
VBoxManage list hostonlyifs
VBoxManage hostonlyif remove <networkName>
vbox
folder in the etc
directory with sudo mkdir
networks.conf
in the vbox
folder, for example by sudo touch
* 0.0.0.0/0 ::/0
docker-machine create -d virtualbox <machineName>
eval $(docker-machine env <machineName>)
to configure your shellP.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...
Upvotes: 59