mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-24 02:50:13 +01:00
feat: do no execute pre/post update commands on linked containers
This commit is contained in:
parent
611c1359ab
commit
cbf6d22b0c
3 changed files with 81 additions and 11 deletions
|
|
@ -29,6 +29,7 @@ func NewContainer(containerInfo *types.ContainerJSON, imageInfo *types.ImageInsp
|
|||
|
||||
// Container represents a running Docker container.
|
||||
type Container struct {
|
||||
Linked bool
|
||||
Stale bool
|
||||
|
||||
containerInfo *types.ContainerJSON
|
||||
|
|
@ -141,6 +142,12 @@ func (c Container) PostUpdateCommand() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// ToRestart return whether the container should be restarted, either because
|
||||
// is stale or linked to another stale container.
|
||||
func (c Container) ToRestart() bool {
|
||||
return c.Stale || c.Linked
|
||||
}
|
||||
|
||||
// Ideally, we'd just be able to take the ContainerConfig from the old container
|
||||
// and use it as the starting point for creating the new container; however,
|
||||
// the ContainerConfig that comes back from the Inspect call merges the default
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue