mirror of
https://github.com/containrrr/watchtower.git
synced 2026-01-01 22:58:49 +01:00
Adds an error check on container removal to ignore errors caused by containers that were removed by other means (errors of type ErrNotFound).
This can be useful when the start of the containers is managed by docker compose or an external system such as systemd.
This commit is contained in:
parent
a4d00bfd75
commit
2dc4ebbcef
1 changed files with 4 additions and 0 deletions
|
|
@ -192,6 +192,10 @@ func (client dockerClient) StopContainer(c Container, timeout time.Duration) err
|
|||
log.Debugf("Removing container %s", shortID)
|
||||
|
||||
if err := client.api.ContainerRemove(bg, idStr, types.ContainerRemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
|
||||
if sdkClient.IsErrNotFound(err) {
|
||||
log.Debugf("Container %s not found, skipping removal.", shortID)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue