Created
February 17, 2019 09:55
-
-
Save Weltraumschaf/ba4c390356e8218be53ebf5a62329650 to your computer and use it in GitHub Desktop.
Create one master and two nodes with Debian to play around with Docker swarm mode.
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# https://manski.net/2016/09/vagrant-multi-machine-tutorial/ | |
BOX_IMAGE = "bento/debian-9" | |
NODE_COUNT = 2 | |
Vagrant.configure("2") do |config| | |
config.vm.define "master" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "master" | |
subconfig.vm.network :private_network, ip: "10.0.0.10" | |
end | |
(1..NODE_COUNT).each do |i| | |
config.vm.define "node#{i}" do |subconfig| | |
subconfig.vm.box = BOX_IMAGE | |
subconfig.vm.hostname = "node#{i}" | |
subconfig.vm.network :private_network, ip: "10.0.0.#{i + 10}" | |
end | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
apt-get update | |
apt-get upgrade -y | |
apt-get install -y \ | |
avahi-daemon \ | |
libnss-mdns \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg2 \ | |
software-properties-common \ | |
tmux \ | |
git | |
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get update | |
apt-get install -y \ | |
docker-ce \ | |
docker-ce-cli \ | |
containerd.io | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment