uncategorized

Automate Docker Image and Container Updates Running on Synology

Updating docker containers is as easy as pulling the image and drop and re-create the container. This can be automated using watchtower appliance, hosted in a docker container itself.

Watchtower is a process for watching your Docker containers and automatically restarting them whenever their base image is refreshed.

Download the docker image

The image is named: centurylink/watchtower

Create container (using terminal)

I’ve set my instance to only match once a day, with a schedule set to every 23h. It will also ensure old image versions are pruned.

docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
centurylink/watchtower \
--interval 82800 \
--cleanup

The docker.sock export is neccessary since we need to control docker.

Automatically check and upgrade running containers

Watchtower will periodically check the repos for updates and upgrade when neccessary, pruning old image versions when upgrade completes.

This will also update the Watchtower image.