From 1c87b364f406f9f376c2ac23bfefdf168fe75eda Mon Sep 17 00:00:00 2001 From: Chai Feng Date: Wed, 3 Oct 2018 09:15:21 +0800 Subject: [PATCH] find all service ufw-docker-agent labels --- docker-entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index dc0cc61..961485f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -6,6 +6,13 @@ ufw_docker_agent_image=192.168.56.120:5000/ufw-docker-agent case "$1" in start) + docker service inspect "$ufw_docker_agent" \ + --format '{{range $k,$v:=.Spec.Labels}}{{$k}} {{$v}}{{"\n"}}{{end}}' | + while read label port; do + [[ -z "$label" ]] && continue + name="${label#ufw.public.}" + echo "${name}=$port" + done sleep 60; exit 1 ;; delete|allow)