1
0
mirror of https://github.com/containrrr/watchtower.git synced 2024-12-15 09:14:13 +02:00

Merge pull request #54 from v2tec/RemoveApiVersionFlag

Set minimum required API Version of docker to 1.24, this basically me…
This commit is contained in:
Fabrizio Steiner 2017-01-24 22:05:10 +01:00 committed by GitHub
commit ce321242bf
3 changed files with 6 additions and 8 deletions

View File

@ -77,7 +77,6 @@ docker run --rm v2tec/watchtower --help
* `--no-pull` Do not pull new images. When this flag is specified, watchtower will not attempt to pull new images from the registry. Instead it will only monitor the local image cache for changes. Use this option if you are building new images directly on the Docker host without pushing them to a registry. * `--no-pull` Do not pull new images. When this flag is specified, watchtower will not attempt to pull new images from the registry. Instead it will only monitor the local image cache for changes. Use this option if you are building new images directly on the Docker host without pushing them to a registry.
* `--cleanup` Remove old images after updating. When this flag is specified, watchtower will remove the old image after restarting a container with a new image. Use this option to prevent the accumulation of orphaned images on your system as containers are updated. * `--cleanup` Remove old images after updating. When this flag is specified, watchtower will remove the old image after restarting a container with a new image. Use this option to prevent the accumulation of orphaned images on your system as containers are updated.
* `--tlsverify` Use TLS when connecting to the Docker socket and verify the server's certificate. * `--tlsverify` Use TLS when connecting to the Docker socket and verify the server's certificate.
* `--apiversion` Specify the minimum docker api version. watchtower will only communicate with docker servers running this api version or later.
* `--debug` Enable debug mode. When this option is specified you'll see more verbose logging in the watchtower log file. * `--debug` Enable debug mode. When this option is specified you'll see more verbose logging in the watchtower log file.
* `--help` Show documentation about the supported flags. * `--help` Show documentation about the supported flags.

View File

@ -1,4 +1,4 @@
package: github.com/stffabi/watchtower package: github.com/v2tec/watchtower
import: import:
- package: github.com/Sirupsen/logrus - package: github.com/Sirupsen/logrus
version: ~0.11.x version: ~0.11.x

11
main.go
View File

@ -16,6 +16,10 @@ import (
"github.com/v2tec/watchtower/container" "github.com/v2tec/watchtower/container"
) )
// DockerAPIMinVersion is the version of the docker API, which is minimally required by
// watchtower. Currently we require at least API 1.24 and therefore Docker 1.12 or later.
const DockerAPIMinVersion string = "1.24"
var ( var (
client container.Client client container.Client
scheduleSpec string scheduleSpec string
@ -75,11 +79,6 @@ func main() {
Name: "debug", Name: "debug",
Usage: "enable debug mode with verbose logging", Usage: "enable debug mode with verbose logging",
}, },
cli.StringFlag{
Name: "apiversion",
Usage: "the version of the docker api",
EnvVar: "DOCKER_API_VERSION",
},
} }
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {
@ -190,7 +189,7 @@ func envConfig(c *cli.Context) error {
err = setEnvOptStr("DOCKER_HOST", c.GlobalString("host")) err = setEnvOptStr("DOCKER_HOST", c.GlobalString("host"))
err = setEnvOptBool("DOCKER_TLS_VERIFY", c.GlobalBool("tlsverify")) err = setEnvOptBool("DOCKER_TLS_VERIFY", c.GlobalBool("tlsverify"))
err = setEnvOptStr("DOCKER_API_VERSION", c.GlobalString("apiversion")) err = setEnvOptStr("DOCKER_API_VERSION", DockerAPIMinVersion)
return err return err
} }