mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
Monitor-only for individual containers (#652)
* Add monitor-only label * Add tests for monitor-only * Treat missing monitor-only label as if the option was set to false * Add docs for container-based monitor-only * Add function doc * Fix monitor-only logic
This commit is contained in:
parent
98b518612b
commit
bde421be0d
7 changed files with 147 additions and 10 deletions
|
@ -162,7 +162,7 @@ Environment Variable: WATCHTOWER_LABEL_ENABLE
|
|||
**Do not** update containers that have `com.centurylinklabs.watchtower.enable` label set to false and no `--label-enable` argument is passed. Note that only one or the other (targeting by enable label) can be used at the same time to target containers.
|
||||
|
||||
## Without updating containers
|
||||
Will only monitor for new images, not update the containers.
|
||||
Will only monitor for new images, send notifications and invoke the [pre-check/post-check hooks](https://containrrr.dev/watchtower/lifecycle-hooks/), but will **not** update the containers.
|
||||
|
||||
> ### ⚠️ Please note
|
||||
>
|
||||
|
@ -175,6 +175,8 @@ Environment Variable: WATCHTOWER_MONITOR_ONLY
|
|||
Default: false
|
||||
```
|
||||
|
||||
Note that monitor-only can also be specified on a per-container basis with the `com.centurylinklabs.watchtower.monitor-only` label set on those containers.
|
||||
|
||||
## Without restarting containers
|
||||
Do not restart containers after updating. This option can be useful when the start of the containers
|
||||
is managed by an external system such as systemd.
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
By default, watchtower will watch all containers. However, sometimes only some containers should be updated.
|
||||
|
||||
There are two options:
|
||||
|
||||
- **Fully exclude**: You can choose to exclude containers entirely from being watched by watchtower.
|
||||
- **Monitor only**: In this mode, watchtower checks for container updates, sends notifications and invokes the [pre-check/post-check hooks](https://containrrr.dev/watchtower/lifecycle-hooks/) on the containers but does **not** perform the update.
|
||||
|
||||
## Full Exclude
|
||||
|
||||
If you need to exclude some containers, set the _com.centurylinklabs.watchtower.enable_ label to `false`.
|
||||
|
||||
```docker
|
||||
|
@ -28,4 +35,24 @@ If you wish to create a monitoring scope, you will need to [run multiple instanc
|
|||
|
||||
Watchtower filters running containers by testing them against each configured criteria. A container is monitored if all criteria are met. For example:
|
||||
- If a container's name is on the monitoring name list (not empty `--name` argument) but it is not enabled (_centurylinklabs.watchtower.enable=false_), it won't be monitored;
|
||||
- If a container's name is not on the monitoring name list (not empty `--name` argument), even if it is enabled (_centurylinklabs.watchtower.enable=true_ and `--label-enable` flag is set), it won't be monitored;
|
||||
- If a container's name is not on the monitoring name list (not empty `--name` argument), even if it is enabled (_centurylinklabs.watchtower.enable=true_ and `--label-enable` flag is set), it won't be monitored;
|
||||
|
||||
## Monitor Only
|
||||
|
||||
Individual containers can be marked to only be monitored (without being updated).
|
||||
|
||||
To do so, set the *com.centurylinklabs.watchtower.monitor-only* label to `true` on that container.
|
||||
|
||||
```docker
|
||||
LABEL com.centurylinklabs.watchtower.monitor-only="true"
|
||||
```
|
||||
|
||||
Or, it can be specified as part of the `docker run` command line:
|
||||
|
||||
```bash
|
||||
docker run -d --label=com.centurylinklabs.watchtower.monitor-only=true someimage
|
||||
```
|
||||
|
||||
When the label is specified on a container, watchtower treats that container exactly as if [`WATCHTOWER_MONITOR_ONLY`](https://containrrr.dev/watchtower/arguments/#without_updating_containers) was set, but the effect is limited to the individual container.
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue