|
|
@ -10,6 +10,7 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
dockercontainer "github.com/docker/docker/api/types/container"
|
|
|
|
dockercontainer "github.com/docker/docker/api/types/container"
|
|
|
|
|
|
|
|
"github.com/docker/go-connections/nat"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// NewContainer returns a new Container instance instantiated with the
|
|
|
|
// NewContainer returns a new Container instance instantiated with the
|
|
|
@ -191,24 +192,22 @@ func (c Container) PreUpdateTimeout() int {
|
|
|
|
|
|
|
|
|
|
|
|
// PostUpdateTimeout checks whether a container has a specific timeout set
|
|
|
|
// PostUpdateTimeout checks whether a container has a specific timeout set
|
|
|
|
// for how long the post-update command is allowed to run. This value is expressed
|
|
|
|
// for how long the post-update command is allowed to run. This value is expressed
|
|
|
|
// either as an integer, in minutes, or as 0 which will allow the command/script
|
|
|
|
// either as an integer, in minutes, or as 0 which will allow the command/script
|
|
|
|
// to run indefinitely. Users should be cautious with the 0 option, as that
|
|
|
|
// to run indefinitely. Users should be cautious with the 0 option, as that
|
|
|
|
// could result in watchtower waiting forever.
|
|
|
|
// could result in watchtower waiting forever.
|
|
|
|
func (c Container) PostUpdateTimeout() int {
|
|
|
|
func (c Container) PostUpdateTimeout() int {
|
|
|
|
var minutes int
|
|
|
|
var minutes int
|
|
|
|
var err error
|
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
|
|
val := c.getLabelValueOrEmpty(postUpdateTimeoutLabel)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minutes, err = strconv.Atoi(val)
|
|
|
|
|
|
|
|
if err != nil || val == "" {
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return minutes
|
|
|
|
val := c.getLabelValueOrEmpty(postUpdateTimeoutLabel)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minutes, err = strconv.Atoi(val)
|
|
|
|
|
|
|
|
if err != nil || val == "" {
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return minutes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// StopSignal returns the custom stop signal (if any) that is encoded in the
|
|
|
|
// StopSignal returns the custom stop signal (if any) that is encoded in the
|
|
|
|
// container's metadata. If the container has not specified a custom stop
|
|
|
|
// container's metadata. If the container has not specified a custom stop
|
|
|
@ -319,8 +318,10 @@ func (c Container) VerifyConfiguration() error {
|
|
|
|
return errorInvalidConfig
|
|
|
|
return errorInvalidConfig
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Instead of returning an error here, we just create an empty map
|
|
|
|
|
|
|
|
// This should allow for updating containers where the exposed ports are missing
|
|
|
|
if len(hostConfig.PortBindings) > 0 && containerConfig.ExposedPorts == nil {
|
|
|
|
if len(hostConfig.PortBindings) > 0 && containerConfig.ExposedPorts == nil {
|
|
|
|
return errorNoExposedPorts
|
|
|
|
containerConfig.ExposedPorts = make(map[nat.Port]struct{})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|