Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Automatically Updating Podman Containers

Published on

Updated on

Recently, I have been transitioning to Podman for running my container infrastructure. In the process, I brought over Watchtower which I have previously used for auto-updating docker containers. Before doing so, I didn’t check its compatibility (whoops) and found a few of my containers would every other week or so not come back up.

I then remembered that I restart my server for general system updates almost every day. What if I perform the podman container updates on start up? After modiyfing my systemd service to include an extra field called ExecStartPre and removing Watchtower, I found no more missing containers! The field ExecStartPre performs a pull (update) before starting up the containers via ExecStart.

Description=Docker Compose Application Service
Requires=network.target podman.socket
After=network.target podman.socket

ExecStartPre=/usr/bin/docker-compose pull
ExecStart=/usr/bin/docker-compose up -d --force-recreate
ExecStop=/usr/bin/docker-compose down

Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :