mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
feat: Checking if DOCKER_API_VERSION is set, if not set it to 1.44, if its lower then 1.44 log warning
This commit is contained in:
parent
909480cefb
commit
84c708e8fc
1 changed files with 11 additions and 0 deletions
11
cmd/root.go
11
cmd/root.go
|
@ -122,6 +122,17 @@ func PreRun(cmd *cobra.Command, _ []string) {
|
||||||
log.Warn("Using `WATCHTOWER_NO_PULL` and `WATCHTOWER_MONITOR_ONLY` simultaneously might lead to no action being taken at all. If this is intentional, you may safely ignore this message.")
|
log.Warn("Using `WATCHTOWER_NO_PULL` and `WATCHTOWER_MONITOR_ONLY` simultaneously might lead to no action being taken at all. If this is intentional, you may safely ignore this message.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if DOCKER_API_VERSION is set
|
||||||
|
if os.Getenv("DOCKER_API_VERSION") == "" {
|
||||||
|
log.Warn("The DOCKER_API_VERSION environment variable is not set. This may cause unexpected behavior while recreating docker containers. Defaulting to 1.44")
|
||||||
|
// set DOCKER_API_VERSION to 1.44
|
||||||
|
os.Setenv("DOCKER_API_VERSION", "1.44")
|
||||||
|
}
|
||||||
|
// check if DOCKER_API_VERSION is set to minimum 1.44 or higher
|
||||||
|
if os.Getenv("DOCKER_API_VERSION") < "1.44" {
|
||||||
|
log.Warn("The DOCKER_API_VERSION environment variable is set to a version lower than 1.44. This may cause unexpected behavior while recreating docker containers.")
|
||||||
|
}
|
||||||
|
|
||||||
client = container.NewClient(container.ClientOptions{
|
client = container.NewClient(container.ClientOptions{
|
||||||
IncludeStopped: includeStopped,
|
IncludeStopped: includeStopped,
|
||||||
ReviveStopped: reviveStopped,
|
ReviveStopped: reviveStopped,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue