mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-13 21:56:38 +01:00
feat: ignore removal error due to non-existing containers (#1481)
Co-authored-by: nils måsén <nils@piksel.se> Fixes https://github.com/containrrr/watchtower/issues/1480
This commit is contained in:
parent
a4d00bfd75
commit
3190ce2df1
3 changed files with 115 additions and 12 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