From 424c2b44741fda07e0ffc526fffc66c00d515a81 Mon Sep 17 00:00:00 2001 From: Chai Feng Date: Wed, 3 Oct 2018 09:14:21 +0800 Subject: [PATCH] Add Dockerfile for image ufw-docker-agent --- .dockerignore | 3 +++ Dockerfile | 19 +++++++++++++++++++ docker-entrypoint.sh | 21 +++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 docker-entrypoint.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7acfa07 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +* +!ufw-docker +!docker-entrypoint.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2533034 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:18.04 + +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 clean autoclean \ + && apt-get autoremove --yes \ + && rm -rf /var/lib/{apt,dpkg,cache,log}/ + +ADD ufw-docker docker-entrypoint.sh /usr/bin/ + +ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"] + +CMD ["start"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..dc0cc61 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +[[ 0 -eq "$#" ]] && set -- start + +ufw_docker_agent_image=192.168.56.120:5000/ufw-docker-agent + +case "$1" in + start) + sleep 60; exit 1 + ;; + delete|allow) + ufw-docker "$@" + ;; + *) + if [[ -f "$1" ]]; then + exec "$@" + else + echo "Unknown parameters: $@" >&2 + exit 1 + fi +esac