Update your docker containers
- hosting
- servers
- infrastructure
- docker
- updates
My containers are out of date!¶
Has it ever happened to you that you run a program in docker, get it set up perfectly and it's been working just fine. But now all of a sudden there's been an update. You're already using the :latest tag for your local deployment, and you want the latest features. How do you do it?
Sure you could recreate the containers, pull the new image manually, but that takes time and effort. We're programmers, so by nature we're lazy. We program things so we don't have to do it again right?
A friend of mine showed me a magic command. Thanks Dreu!
Watchtower¶
Watchtower is a docker container that checks for updates on all the running docker containers. If it finds one, it will recreate your containers using the latest image available and not change any settings.
The Magic Command¶
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once
Caveats¶
It doesn't modify your existing configuration, and it will update all your containers that have updates. If a container needs a different configuration it can break, but honestly how often does this happen? Just be aware of it.