docs: clarify container label usage (#1319)

Co-authored-by: nils måsén <nils@piksel.se>
This commit is contained in:
EDIflyer 2022-07-18 10:54:34 +01:00 committed by GitHub
parent 30f36b3ca2
commit 2aa01da608
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,30 +7,54 @@ There are two options:
## Full Exclude ## 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.
=== "dockerfile"
```docker ```docker
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"
``` ```
=== "docker run"
Or, it can be specified as part of the `docker run` command line:
```bash ```bash
docker run -d --label=com.centurylinklabs.watchtower.enable=false someimage 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"
``` yaml
version: "3"
services:
someimage:
container_name: someimage
labels:
- "com.centurylinklabs.watchtower.enable=false"
```
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.
=== "dockerfile"
```docker ```docker
LABEL com.centurylinklabs.watchtower.enable="true" LABEL com.centurylinklabs.watchtower.enable="true"
``` ```
=== "docker run"
Or, it can be specified as part of the `docker run` command line:
```bash ```bash
docker run -d --label=com.centurylinklabs.watchtower.enable=true someimage 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). 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).
Watchtower filters running containers by testing them against each configured criteria. A container is monitored if all criteria are met. For example: Watchtower filters running containers by testing them against each configured criteria. A container is monitored if all criteria are met. For example: