Skip to content

Commit

Permalink
Upgrade ufw-docker-agent image to Ubuntu 20.04 & Docker 19.03.12
Browse files Browse the repository at this point in the history
  • Loading branch information
chaifeng committed Aug 12, 2020
1 parent 173f965 commit e12810d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
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 \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 \
&& 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}/
Expand Down
11 changes: 6 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 "====================="
Expand Down

0 comments on commit e12810d

Please sign in to comment.