Docker cannot create a machine - 'Error in driver during machine creation' - macos

No idea what the issue is with Docker - I am trying to get the daemon up/running but can't. Here is the error I get:
➜ ~ bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Creating Machine default...
Running pre-create checks...
Creating machine...
(default) OUT | Creating VirtualBox VM...
(default) OUT | Creating SSH key...
(default) OUT | Starting VirtualBox VM...
Error creating machine: Error in driver during machine creation: exit status 1
Starting machine default...
exit status 1
Regenerate TLS machine certs? Warning: this is irreversible. (y/n):
Regenerating TLS certificates
Detecting the provisioner...
Error getting SSH command: Something went wrong running an SSH command!
command : cat /etc/os-release
err : exit status 255
output :
Setting environment variables for machine default...
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
Error getting IP address: Host is not running
docker is configured to use the default machine with IP
For help getting started, check out the docs at https://docs.docker.com
Error running connection boilerplate: default is not running. Please start it
in order to use the connection settings
I am running:
Mac OSX 10.10.5
Docker version 1.9.1, build a34a1d5
VirtualBox version 5.0.10 r104061
I reinstalled the binaries via the toolbox install tool, but to no avail.
VirtualBox is giving a permissions error, so that may be the issue (I installed v4.3 but that didn't help):
/Applications/VirtualBox.app/Contents/MacOS/VMMR0.r0: The owner is not root
If this helps, here is the log output from Kitematic:
/usr/local/bin/docker-machine -D create -d virtualbox --virtualbox-memory 2048 default returned non zero exit code. Stderr: Docker Machine Version: 0.5.1 (7e8e38e) Found binary path at /usr/local/bin/docker-machine-driver-virtualbox
Any suggestions? Thanks

It appears the virtual machine isn't getting created. Start with the same command Kitematic is running to get the full debug out and then add that to your question:
/usr/local/bin/docker-machine -D create -d virtualbox --virtualbox-memory 2048 default

I updated to OSX 10.11 and problem went away. No idea why unfortunately.

I was able to resolve an issue similar.
The issue occurred when I installed docker toolbox a second time.
I uninstalled all Virtual box ethernet drivers virtual box itself and then docker toolbox.
I then recreated the boot2docker machine
docker-machine -D create -d virtualbox --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.9.0/boot2docker.iso --virtualbox-memory 2048 default

Related

docker-machine unable to create a machine on macOS, VBoxManage returning E_ACCESSDENIED error

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.
Thanks to this comment on Reddit, I was able to figure the issue out:
find all the machines with docker-machine ls
remove the ones you don't need with docker-machine rm -y <machineName>
find all the "host-only ethernet adapters" with VBoxManage list hostonlyifs
Remove the orphaned ones with VBoxManage hostonlyif remove <networkName>
Create a vbox folder in the etc directory with sudo mkdir
Create a file networks.conf in the vbox folder, for example by sudo touch
place the below line there
* 0.0.0.0/0 ::/0
create a new machine with docker-machine create -d virtualbox <machineName>
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...

Connecting to docker-engine on remote mac using docker-machine

I have a MacMini that is sitting in the server room which has a docker for mac running on it. I'm able to use docker directly on the machine when I ssh in just fine.
$ docker --version
Docker version 19.03.5, build 633a0ea
But I would like to connect to the mac minis docker engine from my own computer using docker-machine. I have tried the following command to create the docker-machine.
docker-machine create -d generic \
--generic-ip-address 10.0.0.0 \
--generic-ssh-key ~/.ssh/mysshkey \
--generic-ssh-user myusername \
--generic-ssh-port 22 \
macmini
Error Messages:
Running pre-create checks...
Creating machine...
(macmini) Importing SSH key...
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...
Error creating machine: Error detecting OS: Error getting SSH command: ssh command error:
command : cat /etc/os-release
err : exit status 1
output : cat: /etc/os-release: No such file or directory
Has anyone been able to connect remotely to docker-engine running MacOS Catalina using docker-machine? Any tips or pointers would be appreciated. Thank you!

Installing Virtual box for kong Vagrant set up

I am trying to set up vagrant for kong. I have installed VirtualBox and vagrant. But when i run 'vgrant up' i encounter the below issue:
Bringing machine 'default' up with 'virtualbox' provider...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["list", "hostonlyifs"]
Stderr: VBoxManage: error: Failed to create the VirtualBox object!
VBoxManage: error: Code NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) - Class not registered (extended info not available)
I have searched for this error with no much luck.
I am using centos 7.4 and the kernel version is 3.10.0-693.21.1.el7.x86_64.
I have downloaded the relevant gcc, devel and dkms. In short followed the link https://tecadmin.net/install-oracle-virtualbox-on-centos-redhat-and-fedora/
Any tip is appreciated.
Thanks
Dinah
This is most likely a problem with your VirtualBox install, not Vagrant. To confirm this, you should receive the same error when running: VBoxManage list vms
A common reason for this error are when /tmp is full or has the incorrect permissions.
To check if /tmp is full try df -h
To fix permissions on /tmp if they're incorrect, try sudo chmod ug-s /tmp && sudo rm -rf /tmp/.vbox*
Apparently we were trying this on a VM. And Vagrant tries to spin up another VM. So having a VM spun within a VM is causing the issue.

Docker-Machine stuck on creating default

I'm trying to start the default machine of Docker on Mac OSX.
Everytime i'm trying to start a new default machine by command:
docker-machine create --driver virtualbox default
of using Docker Quick Start Terminal It stucks on
(default) Creating SSH key...
This is the output:
Running pre-create checks...
Creating machine...
(default) Copying /Users/avivpaz/.docker/machine/cache/boot2docker.iso to /Users/avivpaz/.docker/machine/machines/default/boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
This is my OSX and Docker versions:
Mac 10.11.3
docker-machine version 0.6.0, build e27fb87
That seems to be followed by issue 2788 and more related to VirtualBox than docker machine.
Try and reboot the Mac, or make sure there is no VBox... process.
First, just delete the boot2docker.iso from ~/cache directory and once again restart the docker terminal. If will download the fresh latest boot2docker.iso and you are good to go.
If it's not working manually download the latest boot2docker.iso and place it into the above directory of cache
/Users/{user}/.docker/machine/cache/
$ ~/.docker/machine/cache
$ ls
boot2docker.iso
And, finally run to create an virtual machine,
docker-machine create --driver virtualbox default
And, again, you are good to go. Hope this helps.

eval "$(docker-machine env default)" leads to Error checking TLS connection

I've installed Docker on my Mac about a month ago, and I now wanted to use it again. The command eval "$(docker-machine env default)" used to work perfectly before, but I now get an error:
Error checking TLS connection: default is not running. Please start it
in order to use the connection settings
I searched around for this error, but I can't really find anything about it. Does anybody know what I should do to solve this? All tips are welcome!
Your boot2docker virtual machine must be running inside Virtualbox.
List your Docker machines:
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Stopped Unknown
Start default machine:
$ docker-machine start default
Starting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
To recreate your default machine:
$ docker-machine rm default
$ docker-machine create --driver virtualbox default
Then you should be able to setup your env with eval "$(docker-machine env default)".

Resources