mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 14:10:12 +01:00
Merge pull request #79 from v2tec/DoNotCallRemoveOnAutoRemove
Do not initiate a RemoveContainer for containers which have AutoRemov…
This commit is contained in:
commit
fec369fd01
1 changed files with 7 additions and 3 deletions
|
|
@ -101,10 +101,14 @@ func (client dockerClient) StopContainer(c Container, timeout time.Duration) err
|
||||||
// Wait for container to exit, but proceed anyway after the timeout elapses
|
// Wait for container to exit, but proceed anyway after the timeout elapses
|
||||||
client.waitForStop(c, timeout)
|
client.waitForStop(c, timeout)
|
||||||
|
|
||||||
log.Debugf("Removing container %s", c.ID())
|
if c.containerInfo.HostConfig.AutoRemove {
|
||||||
|
log.Debugf("AutoRemove container %s, skipping ContainerRemove call.", c.ID())
|
||||||
|
} else {
|
||||||
|
log.Debugf("Removing container %s", c.ID())
|
||||||
|
|
||||||
if err := client.api.ContainerRemove(bg, c.ID(), types.ContainerRemoveOptions{Force: true, RemoveVolumes: false}); err != nil {
|
if err := client.api.ContainerRemove(bg, c.ID(), types.ContainerRemoveOptions{Force: true, RemoveVolumes: false}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for container to be removed. In this case an error is a good thing
|
// Wait for container to be removed. In this case an error is a good thing
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue