Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Setup VM and Install Docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Install
# Adapted from
$script = <<SCRIPT
echo "[SCRIPT] Running as: `whoami`"
echo "\n[SCRIPT] Updating ..."
apt-get update
echo "\n[SCRIPT] Installing"
apt-get install -y
echo "\n[SCRIPT] Modifying vagrant user groups"
# Add the docker group if it doesn't already exist.
groupadd docker
# Add the vagrant user to the docker group.
usermod -a -G docker vagrant
echo "\n[SCRIPT] Restarting Docker daemon"
service restart
exit 0
Vagrant.configure(2) do |config|
# Vagrant knows to look on Atlas to find this box if it is not already installed.
# This box is Docker friendly but does not have docker installed. See
# for more detail. = "phusion/ubuntu-14.04-amd64"
# Remember, shell provisioning is always ran as root
# config.vm.provision "shell", inline: $script <- Un-necessary since docker provisioner installs docker
# The docker provisioner also installs docker to the vm
config.vm.provision "docker",
images: ["ubuntu"]
Copy link

btoone commented Feb 8, 2015

After running vagrant up confirm the Docker install

docker -v
docker run -it ubuntu /bin/bash

Inspect Docker processes

docker ps -a

Copy link

btoone commented Feb 8, 2015

Discovered that the $script is not necessary since the docker provisioner will install Docker for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment