mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
fix: instance cleanup without scope (#1836)
This commit is contained in:
parent
14a468d380
commit
a047c7f9ff
1 changed files with 5 additions and 1 deletions
|
@ -39,7 +39,11 @@ func CheckForSanity(client container.Client, filter types.Filter, rollingRestart
|
||||||
// will stop and remove all but the most recently started container. This behaviour can be bypassed
|
// will stop and remove all but the most recently started container. This behaviour can be bypassed
|
||||||
// if a scope UID is defined.
|
// if a scope UID is defined.
|
||||||
func CheckForMultipleWatchtowerInstances(client container.Client, cleanup bool, scope string) error {
|
func CheckForMultipleWatchtowerInstances(client container.Client, cleanup bool, scope string) error {
|
||||||
containers, err := client.ListContainers(filters.FilterByScope(scope, filters.WatchtowerContainersFilter))
|
filter := filters.WatchtowerContainersFilter
|
||||||
|
if scope != "" {
|
||||||
|
filter = filters.FilterByScope(scope, filter)
|
||||||
|
}
|
||||||
|
containers, err := client.ListContainers(filter)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue