Skip to content

Instantly share code, notes, and snippets.

@btoone
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btoone/87af172e7e1d77eec699 to your computer and use it in GitHub Desktop.
Save btoone/87af172e7e1d77eec699 to your computer and use it in GitHub Desktop.
Setup VM and Install Docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV['VAGRANT_DEFAULT_PROVIDER'] ||= 'virtualbox'
# Install Docker.io
# Adapted from https://docs.docker.com/installation/debian/
$script = <<SCRIPT
echo "[SCRIPT] Running as: `whoami`"
echo "\n[SCRIPT] Updating ..."
apt-get update
echo "\n[SCRIPT] Installing Docker.io"
apt-get install -y docker.io
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 docker.io restart
exit 0
SCRIPT
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
# https://github.com/phusion/open-vagrant-boxes for more detail.
config.vm.box = "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"]
end
@btoone
Copy link
Author

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