I'm new to a docker and tried to create docker host with docker-machine.
Currently, I use VirutalBox for trial environment.
When I created docker host with docker-mahine, it created VM with Boot2Docker on VirtualBox by default. But I want to create a docker host with Ubuntu 15.10 on Virtualbox.
Is it possible to use docker-machine for creating Ubuntu based docker host on VirtualBox?
Is it possible to use docker-machine for creating Ubuntu based docker host on VirtualBox?
Yes, but not with docker-machine directly, which relies on a TinyCore-based linux distribution of 30 Mo only.
You can try and launch a full-fledge Ubuntu VM, and in it follows the regular docker installation for Ubuntu.
OP didn't describe how they used the generic driver to solve their problem, so here's how I did it in case anyone's interested:
sudo su
passwd
ssh-keygen
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
/etc/ssh/sshd_config
and change the line with "PermitRootLogin" so it reads PermitRootLogin yes
service ssh restart
ifconfig
and take note of the machine's IPssh [email protected] 'cat ~/.ssh/id_rsa' > ~/.ssh/docker_test
ssh [email protected] 'cat ~/.ssh/id_rsa.pub' > ~/.ssh/docker_test.pub
shutdown now
echo 'ubuntu-1' > /etc/hostname
and then reboot
. That's only necessary if you're going to create more machines from the same template, then you'd name them ubuntu-1, ubuntu-2 and so onifconfig
to find out the IP of the cloned machinedocker-machine create --driver generic --generic-ip-address 10.10.10.90 --generic-ssh-key ~/.ssh/docker_test ubuntu-1
It might take a few minutes to complete (mostly on the "Installing docker" step) but you should then have a working Ubuntu-based docker machine. You can verify that it works by running docker-machine use ubuntu-1
and then docker run hello-world
It's more involved than using Boot2Docker, but after the initial setup it should be quite workable. I haven't done too much with it yet, I just verified that it seems to work by running hello-world, so there might be more gotchas down the road like there often are with Docker.
Extra tip: VirtualBox allows you to run machines in headless mode. After the initial setup and allowing root access via SSH it'll probably be more convenient to run the machines headless and connect to them via SSH if necessary and you can close VB's GUI and the machines are now running like services in the background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With