Skip to content

Commit

Permalink
docs: clarify container label usage (#1319)
Browse files Browse the repository at this point in the history
Co-authored-by: nils måsén <nils@piksel.se>
  • Loading branch information
EDIflyer and piksel committed Jul 18, 2022
1 parent 30f36b3 commit 2aa01da
Showing 1 changed file with 40 additions and 16 deletions.
56 changes: 40 additions & 16 deletions docs/container-selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down

0 comments on commit 2aa01da

Please sign in to comment.