Proposal: Use docker instead of virtualbox (with vagrant) #111

Closed
wants to merge 1 commit into
from

Projects

None yet

1 participant

@vkurup
Owner
vkurup commented Jul 11, 2014

Vagrant now supports docker as a provider (as of vagrant 1.6) and docker has hit version 1.1.

The goal would be to be able to do:

vagrant up
fab vagrant deploy

... and have an instance set up.

@vkurup vkurup added this to the Ship It Day July 2014 milestone Jul 11, 2014
@vkurup vkurup self-assigned this Jul 11, 2014
Owner
vkurup commented Jul 11, 2014

Posting this as a WIP.

Requirements:

  • Linux 3.8

This should be on the Caktus Ubuntu laptops. Do uname -a to check. If not, do:

sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo reboot

Mac users obviously should not try to upgrade Linux :). But, Vagrant 1.6 and above will create a Virtualbox VM for Mac users, so this should all work on a Mac too.

  • Vagrant 1.6.3
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.3_x86_64.deb
sudo dpkg -i Downloads/vagrant_1.6.3_x86_64.deb
  • Docker 1.1.0

I think vagrant will install docker, but if not go to https://docs.docker.com/installation/. After installing, add your user to the docker group so that you can run commands without sudo:

sudo adduser vkurup docker

Problems I worked around:

  • Finding an image to use

Vagrant's docs recommend using the phusion.baseimage and I eventually went with this recommendation. More information is here: http://phusion.github.io/baseimage-docker/

  • Setting up SSH

Phusion includes a private and public SSH key, which are obviously not secure. I've included the private key in our repo and use that to set get vagrant ssh working.

  • Salt bootstrap doesn't work inside docker container

Github issue: saltstack/salt-bootstrap#394 Basically, the entire install works, but then the shell script calls a command named install_ubuntu_check_services which fails due to an incompatibility with docker. I've included the bootstrap-salt.sh script in our repo, with that command commented out.

Once all this is done, you should be able to run vagrant up --provider=docker. This will download the baseimage and install salt on it. Then you need to get the IP address that the container is listening on, by doing docker inspect --format '{{ .NetworkSettings.IPAddress }}' vagrant. Place that IP address in the fabfile on line 44 and you can run fab vagrant deploy and see an almost successful deploy.

I ended up with errors due to UFW, Postfix and Postgresql, which I have not yet figured out.

Owner
vkurup commented Jun 16, 2015

Closing. I have a feeling that if we wanted to add docker/container support, it would probably be worth starting from a new PR.

@vkurup vkurup closed this Jun 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment