Skip to content

Instantly share code, notes, and snippets.

@zspine
Created Nov 20, 2017
Embed
What would you like to do?
Ubuntu, Setting up a docker development env with Vagrant
$script = <<SCRIPT
# Set up the repository
echo “Update the apt package index...”
sudo apt-get update -y
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Install Docker CE
echo “Install Docker CE...”
sudo apt-get update -y
sudo apt-get install docker-ce -y
sudo usermod -aG docker $USER
echo “Docker CE installed successfully”
# Install Docker Compose
sudo apt-get -y install python-pip
sudo pip install docker-compose
SCRIPT
Vagrant.configure("2") do |config|
config.vm.hostname = "docker1.local"
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.50.2"
config.vm.network "forwarded_port", guest: 80, host: 80
config.vm.provider "virtualbox" do |vb|
vb.name = "docker-node-1"
vb.memory = 1024
vb.cpus = 1
end
config.vm.provision "shell", inline: $script
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment