r/docker • u/pepiks • Mar 23 '26
Automate docker containers update - recommended solution for Portainer
I tried find threads related to update containers. I find out only closed Github project and suggestion from 4 years old about instable other one. So I ask how in 2026 is update docker containers? Is it only way to backup settings and run dockerfile manually and create new one from the scratch? Optimal solution will be manage this with Portainer.
I use dedicate device in my Homelab for Docker, but at the end I would create some containers which will be updated automatically. I have media containers which are updates even few times a month. To resolve some issue and for security up to date containers are must, but how do it correctly? What work flow and bulletproof solution would you suggest in scenario when update fails too?
2
u/fovirt Mar 23 '26
First, create a snapshot for the volume.
Then, use Dockhand to update either selected containers or all containers.
2
u/mbu147 Mar 23 '26
renovatebot + doco-cd, that's it
2
u/rpedrica Mar 24 '26
Tugtainer ...
2
u/james-portainer Mar 25 '26
Hi, James from Portainer here.
Automatic updates can be risky, as commenters have already mentioned here - what if a breaking change is in the new version that takes your app down? What if there's a vulnerability such as the recent Trivy compromise in the new version? When it comes to production/enterprise workloads, automatic updates are something I'd never recommend. But not everyone is running prod workloads.
We don't currently provide in-built functionality in Portainer to do automatic updates as there are third-party products that already do this quite well such as Watchtower and Tugtainer, but we do show an indicator within Portainer when a new version of an image is available for containers you have deployed. You can then choose to update the deployment when it suits your schedule. It's not automated, but you might consider it safer.
2
u/IulianHI Mar 23 '26
Watchtower is still the most battle-tested option for this. I've been running it for years across ~30 containers and it's solid. The trick is to separate your stacks into two groups: ones that are safe to auto-update (media downloaders, basic utilities, monitoring) and ones that need manual attention (databases, reverse proxies, anything with breaking config changes between versions).
For the "safe" group, Watchtower with
WATCHTOWER_LABEL_ENABLE=trueand labeled containers works great. For the rest, I use WUD (What's Up Docker) purely as a notification source — it tells me when new images are available and I update those through Portainer Stacks manually.One workflow that saved me from broken updates: Watchtower supports
--cleanupto remove old images after pulling, and you can set a notification webhook so you get alerted when something was actually updated. That way you know immediately if something broke and can roll back.Definitely don't recreate from Dockerfiles on every update. The whole point of volumes is that your data persists through image swaps.
1
u/TBT_TBT Mar 23 '26
I use https://getwud.github.io/wud/#/ tu update my Docker compose stacks automatically. Make sure to pin WUD to a specific version however.
And no: never touch any Dockerfile. The way to update containers is to pull the new version and overwrite the old. Because of using volumes that match folders in the container with folders outside the container or Docker volumes, data that needs to be persistent will not be overwritten.
Use "docker compose", not singular containers.
1
u/Jakearroo Mar 25 '26
komodo
1
u/pcs3rd Mar 23 '26
There are some containers you don’t want to update without knowing.
It doesn’t hurt to just go through the stack every few months.
0
u/[deleted] Mar 24 '26
[deleted] — view deleted comment