docker-machine does not create virtual machine - docker-machine

I have been going through the Docker get starting tutorial. I can't get docker-machine to create a virtual machine.
My setup:
Host Operating System: Windows 10 Professional
Guest Operating System: Ubuntu 18.04 running on Oracle VirtualBox.
All the Docker stuff is installed on the Ubuntu VM. Oracle VirtualBox is also installed on the Ubuntu machine.
Hyper-Threading is enabled in the BIOS of the physical machine. VirtualBox on Windows 10 also has Hyper-Threading enabled. Despite this, the following command gives an error.
sudo docker-machine create --driver virtualbox myvm1
Running pre-create checks...
Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"
This error makes no sense, because VT-X is already enabled. This led me to try the following:
sudo docker-machine create default2 --virtualbox-no-vtx-check
This goes well until it tries to get an IP. Then it just hangs at the following:
Waiting for an IP...
I have tried searching on this. The only answers I can seem to find suggest saving the machine state of the VM created by docker-machine in VirtualBox and then running it in terminal mode. The problem is, there is never a machine created to begin with. I am at a loss of how to proceed. Does anyone know how to troubleshoot from this point forward?

Related

Run Virtualbox inside docker container, on Windows host

I know this is not what docker containers should be used for, but hear me out. I'm trying to port over a local environment that is currently run on Windows 10 with Chef, Vagrant & Virtualbox.
I believe it is possible to do this in Ubuntu by installing Virtualbox on the host, then mounting the /dev/vboxdrv directory into the container. While there is a vboxdrv directory for the Windows installation C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv, it won't work for a Linux-based container.
Is it possible to get Virtualbox running inside of a Docker container while on a Windows host? I doubt it, but thought I'd ask to confirm in case I had missed some nice workaround.

Running virtualbox/vagrant in a cloud instance

I've tried two things:
First, I tried to install virtualbox on a EC2 machine, which proved to be impossible.
Second, I was able to install both vagrant and virtualbox on a Digital Ocean droplet, but when I tried to run vagrant up, it got stuck on Booting VM.
Several sources on Internet say that it is not possible to run a VM inside a virtualized environment (both Amazon and Digital Ocean provide this).
Is there any way I can solve this with another provider, or is there a way to run vagrant/virtualbox in Amazon or Digital Ocean?
Install VirtualBox and Vagrant on a physical machine such as your desktop
Run the 3 commands from the command line:
vagrant init somenameyoumakeup file://urlToYour.box
vagrant up
vagrant halt
Open the VirtualBox UI
Export the Virtual machine to OVA format using the File -> Export menu
Follow the guide here for importing an OVA: https://aws.amazon.com/ec2/vm-import/

Re-Installing Boot2Docker fails due to apparent VirtualBox running - how to shut them down?

I am trying to re-install boot2docker from
https://github.com/boot2docker/osx-installer/releases/tag/v1.7.0
The installation fails with the following error reported:
The installer has detected that VirtualBox is still running. Please shutdown all running VirtualBox machines and exit VirtualBox then restart the installation.
How can I exit VirtualBox?
Open VirtualBox, it will give you a list of all the VirtualBox VMs you have. You can then easily see which of them are running, and stop them by powering them off.
If boot2docker is still available you should be able to do "boot2docker poweroff" to shutoff the VM behind it.
I've also had some cases where Virtualbox did not show my boot2docker VM as runnning, even though it was. If thats the case, open up your task manager, find the process VBoxHeadless, and kill it.
This is because all the running VMs were not shutdown before uninstalling. Run VBoxManage command to list all running VMs
VBoxManage list runningvms
Then run savestate command to stop the vm
VBoxManage controlvm <name of vm> savestate
Now run the installation again.

How do share the same VM between Windows and Linux when using Vagrant?

I have two hosts, one Windows and one Linux, both with Vagrant and VMware Workstation installed and everything works perfectly fine in their own environment. However, when I create an guest VM in Linux and I do vagrant up in Windows, then Vagrant will delete(!) everything in the .vagrant directory and attempt to fetch the base image. The same thing happens if I do a vagrant init and vagrant up in Windows and then a vagrant up in Linux. How do I prevent this from happening? Is there anyway to share the same VMs between Windows and Linux using Vagrant?
I'm running Windows 7, Ubuntu 14.04, Vagrant 1.6.5, VMware Workstation 10.0.3. This problem occurs for all guest operating systems.
The content of the .vagrant directory can be OS specific, and the internal state of VMware for sure.
I don't think there is easy way to share the same VM instance between the two hosts. The Vagrant way is to provision the VM so you only share the base box and then each user/OS spins up their own instance.
Another option would be to use vagrant package and vagrant box add to transfer the configured box, but that doesn't work with the VMware provider.
Yet another approach would be to use a cloud provider like AWS or Digital Ocean and just ssh into the box. Or maybe even use the vagrant-managed-servers plugin. Your question didn't hint what you use the Vagrant VM for, so it's difficult to tell what would be the best solution.
The following has been tested using the VirtualBox Vagrant provider with Windows 10 and Ubuntu 18.04 in a dual boot setup with a shared NTFS drive where D:\ in Windows is accesible as /mnt/d/ in Linux.
First (but not indispensable if I'm not wrong), set the VAGRANT_HOME environment variable in both Windows and Linux to the same place, e.g.:
Windows, D:\.vagrant.d
Linux, /mnt/d/.vagrant.d
Then create a new machine from one of the OSes, from Linux in the following example:
$ cd /mnt/d/vagrant_machines/machine1
$ vagrant init
$ vagrant up
Then boot in Windows and first backup D:\vagrant_machines\machine1\.vagrant just in case case its contents get accidentally deleted.
Then register from VirtualBox the existing VM, e.g. D:\virtualbox_machines\machine1_default_1587262647987_91775\machine1_default_1587262647987_91775.vbox.
Then run the following:
>vagrant.exe status
The VirtualBox VM was created with a user that doesn't match the
current user running Vagrant. VirtualBox requires that the same user
be used to manage the VM that was created. Please re-run Vagrant with
that user. This is not a Vagrant issue.
The UID used to create the VM was: 1000
Your UID is: 0
And update D:\vagrant_machines\machine1\.vagrant\machines\default\virtualbox\creator_uid to your current UID (0 in this example).
Then start the machine:
>vagrant status
>vagrant up
Finally, note that you will require to update the creator_uid each time that you switch OSes, which you might want to automate.

docker does not run on windows error

I've installed docker and followed the directions here: https://docs.docker.com/installation/windows/#installation but when I run boot2docker start this happens:
Trying to get IP one more time
exit status 255
Docker client does not run on Windows for now. Please use
"boot2docker" ssh
to SSH into the VM instead
Trying boot2docker ssh results in the same 255 error. I tried to get the VM IP with boot2docker IP but that also yielded nothing - I presume because boot2locker wasn't successful in the start process.
A couple of observations...I lloked at the vm settings and there wasn't any network or storage settings specified and the memory allocation in the vm settings didn't match the values in the config (boot2docker config). The boot2docker start/stop commands work.
I'm stumped.
I observed similar issue. Following steps helped me:
Open VirtualBox GUI.
Remove boot2docker-vm virtual machine.
Start Boot2Docker Start --- it will recreate boot2docker-vm virtual machine.
We had exactly this on someone's machine.
The solution for us was to find the
Run the VirtualBox UI (C:\program files\oracle....)
locate the VM (at the top)
select 'power off'
Once all that was done, boot2docker started correctly again.
In extremis, you could delete the boot2docker-vm image out of virtualbox, and it ought to re-install it.
go to the Oracle VM VirtualBox Manager, power off boot2docker-vm and start again. It worked for me.
just in case it helps. My problem was because boot2docker's default settings is beyond my laptop's capability (I know). I fixed the problem by changing the properties of boot2docker-vm through the VirtualBox GUI. Soon as I open thr properties I saw a few warnings at the bottom of the dialogue box, so I followed the hint and resolve those warnings, save the setttings and was able to start docker then.
I changed the CPU from 4->1, memory from 2G to 1.5G and video memory to 20M. Hope it helps.
Mostly you didn't enable the "Virtualization" in your BIOS. boot2docker needs to install 64bit OS in Virtualbox.
Its worth noting I had some huge problems trying to run docker on windows. Boot2docker would install OK with VritualBox 4.3.20. I could NOT run boot2docker or docker itself.
It took me ages to figure out that I had uninstall VirtualBox 4.3.20 and use 4.3.12 instead which worked first time like a treat!
So.. for Windows boot2docker only use VirtualBox 4.3.12.

Resources