Docker on Ubuntu VM running on Mac using Vagrant

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:

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

HOW TO

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).

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.