From b7e1f8860ec4e42d4be89d0985770229e3a755ec Mon Sep 17 00:00:00 2001 From: Chai Feng Date: Mon, 6 Jan 2020 13:17:19 +0800 Subject: [PATCH] Using Docker 19.03.3, auto-restart webapp --- Vagrantfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 3fe0bed..d91080b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,7 +5,7 @@ Vagrant.configure('2') do |config| - config.vm.box = "chaifeng/ubuntu-18.04-docker-19.03" + config.vm.box = "chaifeng/ubuntu-18.04-docker-19.03.3" config.vm.provider 'virtualbox' do |vb| vb.memory = '1024' @@ -116,7 +116,7 @@ DOCKERFILE webapp="${name%:*}_webapp" port="${name#*:}" if docker inspect "$webapp" &>/dev/null; then docker stop "$webapp"; fi - docker run -d --rm --name "$webapp" \ + docker run -d --restart unless-stopped --name "$webapp" \ -p "$port:80" --env name="$webapp" #{private_registry}/chaifeng/hostname-webapp sleep 1 done @@ -159,6 +159,7 @@ DOCKERFILE external.vm.provision "testing", type: 'shell', inline: <<-SHELL set -euo pipefail + set -x server="http://#{ip_prefix}.130" function test-webapp() { timeout 3 curl --silent "$@"; } test-webapp "$server:8080"