From a506c97bfa67933642195f3776e119d37c0f5721 Mon Sep 17 00:00:00 2001 From: Moritz Schlarb Date: Mon, 20 Nov 2023 10:04:07 +0100 Subject: [PATCH] Add example for extensive label usage (Closes: #106) --- examples/docker-compose.labels.yml | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 examples/docker-compose.labels.yml diff --git a/examples/docker-compose.labels.yml b/examples/docker-compose.labels.yml new file mode 100644 index 0000000..2de4224 --- /dev/null +++ b/examples/docker-compose.labels.yml @@ -0,0 +1,40 @@ +version: "3" + +services: + shepherd: + image: containrrr/shepherd + environment: + # Beware YAML gotchas regarding quoting: + # With KEY: 'VALUE', quotes are part of yaml syntax and thus get stripped + # but with KEY='VALUE', they are part of the value and stay there, + # causing problems! + SLEEP_TIME: "1d" + TZ: "US/Eastern" + VERBOSE: "true" + IGNORELIST_SERVICES: "label=shepherd.autodeploy=false" + FILTER_SERVICES: "label=shepherd.autodeploy=true" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + deploy: + placement: + constraints: + - node.role == manager + + # Explicitly enable shepherd for this service + updating-app: + image: hello-world + deploy: + labels: + - shepherd.autodeploy=true + + # Explicitly disable shepherd for this service + not-updating-app: + image: hello-world + deploy: + labels: + - shepherd.autodeploy=false + + # Implicitly disable shepherd for this service + # because of FILTER_SERVICES above + another-not-updating-app: + image: hello-world