Keeping Docker Containers Up to Date


My home network is powered by a few Docker Hosts, whilst the Lab runs Hyper-V.

Keeping things up to date is important, especially when you’re running a number of services that are open out to the internet (even secured via a reverse proxy). Whilst I could manually go into each host and re-build the containers, I could easily use a small container called Watchtower that keeps an eye on container registries and rebuilds containers when a newer image is detected.

For my example below, we’ll be assuming that you’re based in Melbourne Australia and want an update at around 2 AM local time, feel free to update both entries to suit your needs.

docker run -d \
  --name watchtower \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e WATCHTOWER_SCHEDULE="0 0 2 * * *" \
  -e TZ="Australia/Melbourne" \
  ghcr.io/nicholas-fedor/watchtower

We push the update time via a CRON schedule environment variable called WATCHTOWER_SCHEDULE and then ensure that the container is aware of our time zone with the TZ environment variable.

Once it’s up and running it should keep your images up to date – be mindful of major upgrades, recently Immich (which is a great self-hosted image manager) had a major database upgrade which meant I had to make a number of changes before it booted.


Leave a Reply

More Posts

Hyper-V PowerShell Template Script

In my lab environment, I am constantly deploying different Virtual Machines. I’ve built up a number of template vhdx files which are either sysprep’d installs of Windows Server or custom images ready to go. Manually setting up VMs via the User interface can be a little time consuming, so I’ve written up a small PowerShell […]

Bypass Windows 11 TPM Setup Checks

Quick one – I’m doing some testing in my home lab environment with Windows 11 and this box doesn’t have a TPM (so it’s not enabled in Hyper-V). Booting up the Windows 11 iso and trying to install will tell you that it’s unsupported. To get around that, load the setup as normal and once […]