I followed getting started tutorial for docker and reached part 4 where you need to create docker machines using virtualbox (https://docs.docker.com/get-started/part4/#create-a-cluster), though when I try to create it, it fails.
First I used 5.0 virtualbox with docker. And this caused my Ubuntu desktop to freeze everytime I tried to create VM. I had to restart PC in order to make it work. Then I installed newer version of virtualbox: Version 5.2.6 r120293 (Qt5.6.1)
.
Now when trying to create VM with docker, PC does not freeze, but it still can't successfully create VM.
Running this command:
docker-machine create --driver virtualbox myvm1
I get this output:
Running pre-create checks...
Creating machine...
(myvm1) Copying /home/oerp/.docker/machine/cache/boot2docker.iso to /home/oerp/.docker/machine/machines/myvm1/boot2docker.iso...
(myvm1) Creating VirtualBox VM...
(myvm1) Creating SSH key...
(myvm1) Starting the VM...
(myvm1) Check network to re-create if needed...
Error creating machine: Error in driver during machine creation: Unable to start the VM: /usr/bin/VBoxManage startvm myvm1 --type headless failed:
VBoxManage: error: The virtual machine 'myvm1' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
Now opening virtualbox and trying to run "created" VM through virtualbox interface also fails. It says:
RTR3InitEx failed with rc=-1912 (rc=-1912)
The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing
'/sbin/vboxconfig'
may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.
where: supR3HardenedMainInitRuntime what: 4 VERR_VM_DRIVER_VERSION_MISMATCH (-1912) - The installed support driver doesn't match the version of the user.
Running sudo /sbin/vboxvonfig
does not help either. Does that error indicate that I installed incorrect virtualbox for my OS? Or it means something else?
My OS is Ubuntu 16.04
and I downloaded this virtualbox: https://download.virtualbox.org/virtualbox/5.2.6/virtualbox-5.2_5.2.6-120293~Ubuntu~xenial_amd64.deb
P.S. If it is important my running OS (in my PC) is not inside virtual machine.
It seems there was some leftovers from virtualbox 5.0, when I installed virtualbox 5.2. So this caused mentioned issues.
So for anyone having similar problems when one version hangs your PC unexpectedly and another get stuck mixed with older version left overs, you can try doing this (it helped me. It looks like it has something to do with old linux headers not being aware of new virtualbox?):
sudo apt-get purge virtualbox-*.* dkms linux-headers-$(uname -r) # (where * is specified version)
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install virtualbox-*.*
This was found at: https://askubuntu.com/questions/205154/virtualbox-etc-init-d-vboxdrv-setup-issue
Then it should solve mismatch version error.
P.S. Though note if you already tried to create VM using docker-machine (and then removed them). It can give you an another error, when created new VMs. It is related with certificates.
For me certificates were left intact, even though I removed not working virtual machines. It probably was checking old certificates, because I was using same virtual machine name?
So it gave me this new error:
Copying certs to the local machine directory...
Error creating machine: Error running provisioning: error generating server cert: tls: failed to find any PEM data in certificate input
To solve it, you can remove /home/user/.docker/machine/certs
directory. After that, when you start new VM, it will regenerate new certs and should not raise this error anymore.