Setup Watchtower - Container AutoUpdater

Setup v2tec/watchtower on Docker

In this post we are going to setup Watchtower, setup is download and run

1.- Container setup 

  • docker run -d --name watchtower --restart always -v /var/run/docker.sock:/var/run/docker.sock v2tec/watchtower -i 3600 --cleanup

Options

Any of the options described below can be passed to the watchtower process by setting them after the image name in the docker run string:
docker run --rm v2tec/watchtower --help

  • --host, -h Docker daemon socket to connect to. Defaults to "unix:///var/run/docker.sock" but can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port". The host value can also be provided by setting the DOCKER_HOST environment variable.
  • --interval, -i Poll interval (in seconds). This value controls how frequently watchtower will poll for new images. Defaults to 300 seconds (5 minutes).
  • --schedule, -s Cron expression in 6 fields (rather than the traditional 5) which defines when and how often to check for new images. Either --interval or the schedule expression could be defined, but not both. An example: --schedule "0 0 4 * * *" 
  • --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.
  • --stop-timeout Timeout before the container is forcefully stopped. When set, this option will change the default (10s) wait time to the given value. An example: --stop-timeout 30s will set the timeout to 30 seconds.
  • --label-enable Watch containers where the com.centurylinklabs.watchtower.enable label is set to true.
  • --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.
  • --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.

Source: https://github.com/v2tec/watchtower/blob/master/README.md


Comments