Checking for updates can be configured to run during a pre-specific maintenance window by specifying a cron expression to the --schedule
argument in the auto_update
container’s command.
In the docker-compose.yml
file, scroll to the configurations of the container with image containrrr/watchtower
. It'll be named either auto_update or watchtower. This is what your configuration will look like
auto_update:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Checks for update every 5 mins because of --interval
command: --interval 300 --label-enable --cleanup
networks:
- appsmith
restart: always
In the command
configuration, please remove the --interval
argument and the value 300
next to it, and in it’s place, add a --schedule
and a cron expression defining an update interval of your choice. Your new configuration will look like below.
auto_update:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Check for updates every hour because of the cron schedule
command: --schedule "0 0 * ? * *" --label-enable --cleanup
networks:
- appsmith
restart: always
ℹ️ Note that a 6-value cron expression is expected here, not the traditional 5-value one. For details on how the expression works, please refer to (https://pkg.go.dev/github.com/robfig/[email protected]#hdr-CRON\_Expression\_Format)
After making the changes restart the auto update container via the command below:
# Use the container name as defined in your docker-compose.yml file. This command uses the name: auto_update
sudo docker-compose pull && sudo docker-compose up --force-recreate auto_update
Check the logs and see that the maintenance window is now in effect.
docker-compose logs -f auto_update
Check for updates every Sunday at 12:00:
command: --schedule "0 0 12 ? * SUN" --label-enable --cleanup
Check for updates every hour:
command: --schedule "0 0 * ? * *" --label-enable --cleanup
Check for updates once at 12:00 everyday:
command: --schedule "0 0 12 * * ?" --label-enable --cleanup