Upgrade ufw-docker-agent image to Ubuntu 20.04 & Docker 19.03.12
This commit is contained in:
parent
173f9659d7
commit
e12810d055
10
Dockerfile
10
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 \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends apt-transport-https \
|
&& apt-get install -y --no-install-recommends apt-transport-https \
|
||||||
ca-certificates curl software-properties-common gnupg dirmngr \
|
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 \
|
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||||
$(lsb_release -cs) stable" \
|
$(lsb_release -cs) stable" \
|
||||||
&& apt-get update \
|
&& 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 clean autoclean \
|
||||||
&& apt-get autoremove --yes \
|
&& apt-get autoremove --yes \
|
||||||
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
|
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||||
|
11
Vagrantfile
vendored
11
Vagrantfile
vendored
@ -6,6 +6,7 @@
|
|||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
|
|
||||||
config.vm.box = "chaifeng/ubuntu-20.04-docker-19.03.11"
|
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|
|
config.vm.provider 'virtualbox' do |vb|
|
||||||
vb.memory = '1024'
|
vb.memory = '1024'
|
||||||
@ -112,10 +113,10 @@ DOCKERFILE
|
|||||||
|
|
||||||
master.vm.provision "local-webapp", type: 'shell', inline: <<-SHELL
|
master.vm.provision "local-webapp", type: 'shell', inline: <<-SHELL
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
for name in public:8080 local:8000; do
|
for name in public:18080 local:8000; do
|
||||||
webapp="${name%:*}_webapp"
|
webapp="${name%:*}_webapp"
|
||||||
port="${name#*:}"
|
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" \
|
docker run -d --restart unless-stopped --name "$webapp" \
|
||||||
-p "$port:80" --env name="$webapp" #{private_registry}/chaifeng/hostname-webapp
|
-p "$port:80" --env name="$webapp" #{private_registry}/chaifeng/hostname-webapp
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -126,7 +127,7 @@ DOCKERFILE
|
|||||||
|
|
||||||
master.vm.provision "swarm-webapp", type: 'shell', inline: <<-SHELL
|
master.vm.provision "swarm-webapp", type: 'shell', inline: <<-SHELL
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
for name in public:9090 local:9000; do
|
for name in public:29090 local:9000; do
|
||||||
webapp="${name%:*}_service"
|
webapp="${name%:*}_service"
|
||||||
port="${name#*:}"
|
port="${name#*:}"
|
||||||
if docker service inspect "$webapp" &>/dev/null; then docker service rm "$webapp"; fi
|
if docker service inspect "$webapp" &>/dev/null; then docker service rm "$webapp"; fi
|
||||||
@ -162,10 +163,10 @@ DOCKERFILE
|
|||||||
set -x
|
set -x
|
||||||
server="http://#{ip_prefix}.130"
|
server="http://#{ip_prefix}.130"
|
||||||
function test-webapp() { timeout 3 curl --silent "$@"; }
|
function test-webapp() { timeout 3 curl --silent "$@"; }
|
||||||
test-webapp "$server:8080"
|
test-webapp "$server:18080"
|
||||||
! test-webapp "$server:8000"
|
! test-webapp "$server:8000"
|
||||||
|
|
||||||
test-webapp "$server:9090"
|
test-webapp "$server:29090"
|
||||||
! test-webapp "$server:9000"
|
! test-webapp "$server:9000"
|
||||||
|
|
||||||
echo "====================="
|
echo "====================="
|
||||||
|
Loading…
Reference in New Issue
Block a user