|
| 1 | +# encoding: utf-8 |
| 2 | +# -*- mode: ruby -*- |
| 3 | +# vi: set ft=ruby : |
| 4 | + |
| 5 | +Vagrant.configure(2) do |config| |
| 6 | + |
| 7 | + config.vm.define :ubuntu1604 do |ubuntu1604| |
| 8 | + ubuntu1604.vm.box = 'ubuntu/xenial64' # https://atlas.hashicorp.com/ubuntu/boxes/xenial64 |
| 9 | + # install docker |
| 10 | + ubuntu1604.vm.provision :shell, inline: 'curl -fsSL https://get.docker.com/ | sh' |
| 11 | + # add vagrant user to docker group |
| 12 | + ubuntu1604.vm.provision :shell, inline: 'usermod -aG docker ubuntu' |
| 13 | + # reload and restart docker daemon |
| 14 | + ubuntu1604.vm.provision :shell, inline: 'systemctl daemon-reload' |
| 15 | + ubuntu1604.vm.provision :shell, inline: 'systemctl restart docker.service' |
| 16 | + # start one docker container |
| 17 | + ubuntu1604.vm.provision :shell, inline: 'docker run -d ubuntu /bin/bash -c "while true; do echo hello world; sleep 1; done"' |
| 18 | + end |
| 19 | + |
| 20 | + config.vm.define :centos7 do |centos7| |
| 21 | + centos7.vm.box = 'centos/7' # https://atlas.hashicorp.com/centos/boxes/7 |
| 22 | + # install docker |
| 23 | + centos7.vm.provision :shell, inline: 'curl -fsSL https://get.docker.com/ | sh' |
| 24 | + # add vagrant user to docker group |
| 25 | + centos7.vm.provision :shell, inline: 'usermod -aG docker vagrant' |
| 26 | + # reload and restart docker daemon |
| 27 | + centos7.vm.provision :shell, inline: 'systemctl daemon-reload' |
| 28 | + centos7.vm.provision :shell, inline: 'systemctl restart docker.service' |
| 29 | + # start one docker container |
| 30 | + centos7.vm.provision :shell, inline: 'docker run -d ubuntu /bin/bash -c "while true; do echo hello world; sleep 1; done"' |
| 31 | + end |
| 32 | + |
| 33 | + config.vm.define :debian8 do |debian8| |
| 34 | + debian8.vm.box = 'debian/jessie64' # https://atlas.hashicorp.com/debian/boxes/jessie64/ |
| 35 | + # install curl |
| 36 | + debian8.vm.provision :shell, inline: 'apt-get update' |
| 37 | + debian8.vm.provision :shell, inline: 'apt-get install -y curl' |
| 38 | + # install docker |
| 39 | + debian8.vm.provision :shell, inline: 'curl -fsSL https://get.docker.com/ | sh' |
| 40 | + # add vagrant user to docker group |
| 41 | + debian8.vm.provision :shell, inline: 'usermod -aG docker vagrant' |
| 42 | + # reload and restart docker daemon |
| 43 | + debian8.vm.provision :shell, inline: 'systemctl daemon-reload' |
| 44 | + debian8.vm.provision :shell, inline: 'systemctl restart docker.service' |
| 45 | + # start one docker container |
| 46 | + debian8.vm.provision :shell, inline: 'docker run -d ubuntu /bin/bash -c "while true; do echo hello world; sleep 1; done"' |
| 47 | + end |
| 48 | +end |
0 commit comments