Docker allows you to develop, ship and run any application, anywhere. The metaphor is that of the standard shipping container that fits on any ship, can be handled by any crane, and loaded onto any train or truck.
In a previous post, I covered how to run Ubuntu on Mac using Vagrant. In this post, I will show how to run Docker on the Ubuntu box we got running with Vagrant.
I will cover how to:
- Shell provisioning of Docker with Vagrant. Vagrant and Docker are now best friends, so the shell provisioning approach can be tweaked, although I don't think it is too horrible.
- Do basic stuff in Docker. To get more familiar with Docker, I also recommend reading the Understanding Docker, Installing Docker and Using Docker articles.
Provisioning Docker on "vagrant up"
First, create a Vagrant setup like previously described. Then, edit the install.sh script, and enter some Docker installation commands:
install.sh
:
#!/bin/sh curl -sSL https://get.docker.io/ | sh
Now, let's test that docker was installed as intended:
vagrant up vagrant ssh
(Fix) chown the docker socket:
# Now on vagrant machine sudo chown vagrant /var/run/docker.sock # TODO: need to address this issue in a different way
Check docker version:
docker version
Run a hello world:
docker pull ubuntu docker run ubuntu echo "Hello, world"
Basic Docker usage
Get your applications into Docker containers
TODO
Shipping containers to team members
TODO
Deploying applications to production
TODO
Aside: Deploying containers on AWS
Summary
This post shows how to get up and running with Vagrant and Docker using the install scripts provided at get.docker.io. In the next post I will show how to use the "new" way to use Docker with Vagrant (thanks to Jens Roland for pointing me in the right direction).