mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
Add --revive-stopped flag to start stopped containers after an update (#403)
* Add --revive-stopped flag to start stopped containers after an update * Update arguments.md
This commit is contained in:
parent
63e5049160
commit
2d8507ca31
4 changed files with 23 additions and 3 deletions
|
@ -38,7 +38,7 @@ type Client interface {
|
|||
// * DOCKER_HOST the docker-engine host to send api requests to
|
||||
// * DOCKER_TLS_VERIFY whether to verify tls certificates
|
||||
// * DOCKER_API_VERSION the minimum docker api version to work with
|
||||
func NewClient(pullImages bool, includeStopped bool, removeVolumes bool) Client {
|
||||
func NewClient(pullImages bool, includeStopped bool, reviveStopped bool, removeVolumes bool) Client {
|
||||
cli, err := dockerclient.NewClientWithOpts(dockerclient.FromEnv)
|
||||
|
||||
if err != nil {
|
||||
|
@ -50,6 +50,7 @@ func NewClient(pullImages bool, includeStopped bool, removeVolumes bool) Client
|
|||
pullImages: pullImages,
|
||||
removeVolumes: removeVolumes,
|
||||
includeStopped: includeStopped,
|
||||
reviveStopped: reviveStopped,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +59,7 @@ type dockerClient struct {
|
|||
pullImages bool
|
||||
removeVolumes bool
|
||||
includeStopped bool
|
||||
reviveStopped bool
|
||||
}
|
||||
|
||||
func (client dockerClient) ListContainers(fn t.Filter) ([]Container, error) {
|
||||
|
@ -203,7 +205,7 @@ func (client dockerClient) StartContainer(c Container) (string, error) {
|
|||
|
||||
}
|
||||
|
||||
if !c.IsRunning() {
|
||||
if !c.IsRunning() && !client.reviveStopped {
|
||||
return createdContainer.ID, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue