Created
November 20, 2017 06:13
-
-
Save zspine/cdc08c39ea019d4924fcca37eaa19b93 to your computer and use it in GitHub Desktop.
Ubuntu, Setting up a docker development env with Vagrant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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