{"title":"Podman Auto Updating Systemd Services","url":"https://seanbehan.ca/posts/podman-systemd","description":"podman generate systemd plus an autoupdate label: containers that start on boot and update themselves.","author":"Sean Behan","published":"2021-09-23T14:34:43.000Z","updated":null,"draft":false,"tags":["docker","linux","podman"],"readingMinutes":1,"image":null,"sections":[{"id":"introduction","text":"Introduction","level":2},{"id":"auto-updating-containers","text":"Auto-Updating Containers","level":2},{"id":"kubernetes-yaml-generation","text":"Kubernetes YAML Generation","level":2}],"content_format":"text/markdown","content_url":"https://seanbehan.ca/posts/podman-systemd.md","content":"### Introduction\n\nPodman[^1] has a nice feature called `generate` that lets you generate\n\ndifferent kinds of configuration files for starting pods. One that I use often\n\nis `podman generate systemd` which generates a new user service that can be\n\nstarted with `systemctl --user start container-yourcontainer.service` or\n\nenabled.\n\n### Auto-Updating Containers\n\nIf you want your container to auto update you can simply pass it the flag\n\n`--label \"io.containers.autoupdate=registry\"` when you're creating it. The\n\nsystemd service will automatically pull the latest versions of containers\n\nbefore starting them. You can manually update your container images now using\n\n`podman auto-update`.\n\nIf you want to update your images on a schedule you can enable the\n\n`podman-auto-update.timer` using `systemctl --user enable --now\n\npodman-auto-update.timer` which will auto update your containers every Monday\n\nmorning.[^2]\n\n### Kubernetes YAML Generation\n\nYou can also generate a Kubernetes YAML configurations using `podman generate\n\nkube`. This can then be loaded in Kubernetes to run your containers.\n\n[^1]: https://podman.io\n\n[^2]: https://fedoramagazine.org/auto-updating-podman-containers-with-systemd/\n"}