Docker compose deployment
Create a custom template on portainer or a docker-compose.yml
The WATCHTOWER_CLEANUP environment variable will delete the images that have been updated and the WATCHTOWER_RUN_ONCE will run watchtower, perform the updates and exit, thus giving you control when you want them to happen.
version: "3" services: watchtower: image: containrrr/watchtower container_name: watchtower environment: - WATCHTOWER_CLEANUP=true - WATCHTOWER_RUN_ONCE=true volumes: - /var/run/docker.sock:/var/run/docker.sock - /etc/localtime:/etc/localtime:ro
Run this whenever you are available to upgrade your containers.
It's wise to add the following label to your portainer or agent compose file so that watchtower only reports whether it needs update without updating it and disrupting the monitoring during the update.
version: "3.3" services: portainer: image: portainer/portainer-ce container_name: portainer labels: - com.centurylinklabs.watchtower.monitor-only=true
Note that the version has to be 3.3 and up.