How to fix docker-machine installation on Mac OS X
Recently i got a new macbook pro and i started setting it up. Everything was going great until i tried to install docker and create default
docker machine. After i installed Docker for Mac, i tried to start virtual machine :
docker-machine create -d virtualbox default
Running pre-create checks...
Creating machine...
(default) Copying /Users/andrew/.docker/machine/cache/boot2docker.iso to /Users/andrew/.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) Creating a new host-only adapter produced an error: /usr/local/bin/VBoxManage hostonlyif create failed:
(default) 0%...
(default) Progress state: NS_ERROR_FAILURE
(default) VBoxManage: error: Failed to create the host-only adapter
(default) VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
(default) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp
(default)
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
After some googling i found couple of solutions for the problem :
- Reinstall VM and then restart computer
- Install older version of VM, install it and then restart computer
- Restart VirtualBox
Tried all of them and everytime it was a failure. One thing was not leaving me in piece - when i was re-installing VirtualBox i was getting an error during installation :
Still, i was able to launch VirtualBox UI and even see that default
machine was created. Though, when i tried to start it - i was getting driver not installed (rc=-1908)
error. This got me to one thread, where i found a suggestion to check Mac OS Privacy settings and check if VirtualBox software was asking for permissions or not. And that was it ! So, to fix this problem you just have to :
- Start VirtualBox installation
- Wait for it to Fail
- Open
Settings->Security&Privacy
- On the bottom there will be a record that
System software from 'Oracle' developer was blocked from loading
- Tap
Allow
button - Install VirtualBox again.
At the end you should have a Successful
installation of VirtualBox and now you can
docker-machine create -d virtualbox default
Running pre-create checks...
Creating machine...
(default) Copying /Users/andrew/.docker/machine/cache/boot2docker.iso to /Users/andrew/.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"
(default) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default
Now you just need to docker-machine env default
and you are all set.
Happy coding ! :)