Add a method of enabling or disabling containers using labels

Switch command line flag from no-enable to label-enable and simplify logic

Add basic documentation for the --label-enable flag
This commit is contained in:
Kaleb Elwert 2017-10-17 06:53:30 +02:00 committed by Fabrizio Steiner
parent f365014b8f
commit de2ac9341d
4 changed files with 56 additions and 5 deletions

View file

@ -79,6 +79,11 @@ func main() {
Usage: "use TLS and verify the remote",
EnvVar: "DOCKER_TLS_VERIFY",
},
cli.BoolFlag{
Name: "label-enable",
Usage: "watch containers where the com.centurylinklabs.watchtower.enable label is true",
EnvVar: "WATCHTOWER_LABEL_ENABLE",
},
cli.BoolFlag{
Name: "debug",
Usage: "enable debug mode with verbose logging",
@ -146,7 +151,7 @@ func before(c *cli.Context) error {
return err
}
client = container.NewClient(!c.GlobalBool("no-pull"))
client = container.NewClient(!c.GlobalBool("no-pull"), c.GlobalBool("label-enable"))
notifier = notifications.NewNotifier(c)
return nil