Skip to content

Instantly share code, notes, and snippets.

@nicosingh
Last active December 7, 2017 16:35
Show Gist options
  • Save nicosingh/fcb0bce6acc13e514778053ce4624a80 to your computer and use it in GitHub Desktop.
Save nicosingh/fcb0bce6acc13e514778053ce4624a80 to your computer and use it in GitHub Desktop.
Docker inside a vagrant box

Docker inside a vagrant box

Requirements:

  • Virtualbox
  • Vagrant

How to use:

  1. Download this Gist as a zipfile
  2. Run vagrant up to create and provision a new box
  3. Run vagrant ssh to use this box
#!/bin/bash
apt-get remove docker docker-engine docker.io
apt-get update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce -y
rm -rf /var/lib/apt/lists/*
usermod -aG docker vagrant
service docker restart
Vagrant.configure("2") do |config|
config.vm.box = "debian/contrib-stretch64"
config.vm.provision "shell", path: "provision.sh", privileged: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment