From 2aa01da608199bc2761e24c8307e4885fd2c616c Mon Sep 17 00:00:00 2001 From: EDIflyer Date: Mon, 18 Jul 2022 10:54:34 +0100 Subject: [PATCH] docs: clarify container label usage (#1319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: nils måsén --- docs/container-selection.md | 56 ++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/docs/container-selection.md b/docs/container-selection.md index b5ccafb..4b6facd 100644 --- a/docs/container-selection.md +++ b/docs/container-selection.md @@ -7,29 +7,53 @@ There are two options: ## Full Exclude -If you need to exclude some containers, set the _com.centurylinklabs.watchtower.enable_ label to `false`. +If you need to exclude some containers, set the _com.centurylinklabs.watchtower.enable_ label to `false`. For clarity this should be set **on the container(s)** you wish to be ignored, this is not set on watchtower. -```docker -LABEL com.centurylinklabs.watchtower.enable="false" -``` +=== "dockerfile" -Or, it can be specified as part of the `docker run` command line: + ```docker + LABEL com.centurylinklabs.watchtower.enable="false" + ``` +=== "docker run" -```bash -docker run -d --label=com.centurylinklabs.watchtower.enable=false someimage -``` + ```bash + docker run -d --label=com.centurylinklabs.watchtower.enable=false someimage + ``` -If you need to [include only containers with the enable label](https://containrrr.github.io/watchtower/arguments/#filter_by_enable_label), pass the `--label-enable` flag or the `WATCHTOWER_LABEL_ENABLE` environment variable on startup and set the _com.centurylinklabs.watchtower.enable_ label with a value of `true` for the containers you want to watch. +=== "docker-compose" -```docker -LABEL com.centurylinklabs.watchtower.enable="true" -``` + ``` yaml + version: "3" + services: + someimage: + container_name: someimage + labels: + - "com.centurylinklabs.watchtower.enable=false" + ``` -Or, it can be specified as part of the `docker run` command line: +If instead you want to [only include containers with the enable label](https://containrrr.github.io/watchtower/arguments/#filter_by_enable_label), pass the `--label-enable` flag or the `WATCHTOWER_LABEL_ENABLE` environment variable on startup for watchtower and set the _com.centurylinklabs.watchtower.enable_ label with a value of `true` on the containers you want to watch. -```bash -docker run -d --label=com.centurylinklabs.watchtower.enable=true someimage -``` +=== "dockerfile" + + ```docker + LABEL com.centurylinklabs.watchtower.enable="true" + ``` +=== "docker run" + + ```bash + docker run -d --label=com.centurylinklabs.watchtower.enable=true someimage + ``` + +=== "docker-compose" + + ``` yaml + version: "3" + services: + someimage: + container_name: someimage + labels: + - "com.centurylinklabs.watchtower.enable=true" + ``` If you wish to create a monitoring scope, you will need to [run multiple instances and set a scope for each of them](https://containrrr.github.io/watchtower/running-multiple-instances).