Skip to content

Commit 2aa01da

Browse files
EDIflyerpiksel
andauthored
docs: clarify container label usage (#1319)
Co-authored-by: nils måsén <[email protected]>
1 parent 30f36b3 commit 2aa01da

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

docs/container-selection.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,53 @@ There are two options:
77

88
## Full Exclude
99

10-
If you need to exclude some containers, set the _com.centurylinklabs.watchtower.enable_ label to `false`.
10+
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.
1111

12-
```docker
13-
LABEL com.centurylinklabs.watchtower.enable="false"
14-
```
12+
=== "dockerfile"
1513

16-
Or, it can be specified as part of the `docker run` command line:
14+
```docker
15+
LABEL com.centurylinklabs.watchtower.enable="false"
16+
```
17+
=== "docker run"
1718

18-
```bash
19-
docker run -d --label=com.centurylinklabs.watchtower.enable=false someimage
20-
```
19+
```bash
20+
docker run -d --label=com.centurylinklabs.watchtower.enable=false someimage
21+
```
2122

22-
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.
23+
=== "docker-compose"
2324

24-
```docker
25-
LABEL com.centurylinklabs.watchtower.enable="true"
26-
```
25+
``` yaml
26+
version: "3"
27+
services:
28+
someimage:
29+
container_name: someimage
30+
labels:
31+
- "com.centurylinklabs.watchtower.enable=false"
32+
```
2733

28-
Or, it can be specified as part of the `docker run` command line:
34+
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.
2935

30-
```bash
31-
docker run -d --label=com.centurylinklabs.watchtower.enable=true someimage
32-
```
36+
=== "dockerfile"
37+
38+
```docker
39+
LABEL com.centurylinklabs.watchtower.enable="true"
40+
```
41+
=== "docker run"
42+
43+
```bash
44+
docker run -d --label=com.centurylinklabs.watchtower.enable=true someimage
45+
```
46+
47+
=== "docker-compose"
48+
49+
``` yaml
50+
version: "3"
51+
services:
52+
someimage:
53+
container_name: someimage
54+
labels:
55+
- "com.centurylinklabs.watchtower.enable=true"
56+
```
3357

3458
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).
3559

0 commit comments

Comments
 (0)