diff --git a/Dockerfile b/Dockerfile index d41fd2b..e9095d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 +ARG docker_version="19.03.12" + +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install -y --no-install-recommends apt-transport-https \ ca-certificates curl software-properties-common gnupg dirmngr \ @@ -7,7 +10,10 @@ RUN apt-get update \ && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" \ && apt-get update \ - && apt-get install -y --no-install-recommends ufw "docker-ce=18.06.1~*" \ + && apt-get install -y --no-install-recommends locales ufw \ + && ( apt-get install -y --no-install-recommends "docker-ce=5:${docker_version}~*" || \ + apt-get install -y --no-install-recommends "docker-ce=${docker_version}~*" ) \ + && locale-gen en_US.UTF-8 \ && apt-get clean autoclean \ && apt-get autoremove --yes \ && rm -rf /var/lib/{apt,dpkg,cache,log}/ diff --git a/Vagrantfile b/Vagrantfile index 877efb6..1499184 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,6 +6,7 @@ Vagrant.configure('2') do |config| config.vm.box = "chaifeng/ubuntu-20.04-docker-19.03.11" + #config.vm.box = "chaifeng/ubuntu-16.04-docker-18.03" config.vm.provider 'virtualbox' do |vb| vb.memory = '1024' @@ -112,10 +113,10 @@ DOCKERFILE master.vm.provision "local-webapp", type: 'shell', inline: <<-SHELL set -euo pipefail - for name in public:8080 local:8000; do + for name in public:18080 local:8000; do webapp="${name%:*}_webapp" port="${name#*:}" - if docker inspect "$webapp" &>/dev/null; then docker stop "$webapp"; fi + if docker inspect "$webapp" &>/dev/null; then docker rm -f "$webapp"; fi docker run -d --restart unless-stopped --name "$webapp" \ -p "$port:80" --env name="$webapp" #{private_registry}/chaifeng/hostname-webapp sleep 1 @@ -126,7 +127,7 @@ DOCKERFILE master.vm.provision "swarm-webapp", type: 'shell', inline: <<-SHELL set -euo pipefail - for name in public:9090 local:9000; do + for name in public:29090 local:9000; do webapp="${name%:*}_service" port="${name#*:}" if docker service inspect "$webapp" &>/dev/null; then docker service rm "$webapp"; fi @@ -162,10 +163,10 @@ DOCKERFILE set -x server="http://#{ip_prefix}.130" function test-webapp() { timeout 3 curl --silent "$@"; } - test-webapp "$server:8080" + test-webapp "$server:18080" ! test-webapp "$server:8000" - test-webapp "$server:9090" + test-webapp "$server:29090" ! test-webapp "$server:9000" echo "====================="