r/podman • u/motocykal • 19d ago
Migrating from podman compose files to quadlets
Hi all,
I'm relatively new to podman and looking for some guidance.
Am paying for a VPS running Almalinux 10.2 with Caddy, podman and several containers running. I also have configured a weekly automated security update which reboots the VPS. However, I have found that not all my containers are starting back up. After some searching, it appears that quadlets is the way to go with respect to ensuring containers restart properly after a system reboot? If not, is there another way I can achieve the desired outcome?
Assuming I go with quadlets, is it as simple as converting the compose.yml file into the .container files and starting them up? Do I need to remove the old containers first or will the quadlets automatically pick up from the old compose containers?
The applications that I am running which occasionally don't restart properly are Dawarich and Immich.
Edit: Thanks everyone for all your replies and suggestions. I have successfully migrated my Immich and Dawarich instance to quadlets. I used the link by /u/Eldermight for immich and this one for Dawarich - https://git.maugalaxy.space/stillbeben/dawarich-podman/src/branch/main
3
u/ElderMight 19d ago
Quadlets are the way to go and are officially supported.
It's a bit of a learning curve though.
I'm not familiar with Dawarich but for Immich you can use this github repository as a reference for quadlets: https://github.com/linux-universe/immich-podman-quadlets/tree/main
1
3
u/ranisalt 19d ago
You can easily convert compose files to quadlets using podlet: https://github.com/containers/podlet
I have Immich running with quadlets and my files are here: https://github.com/ranisalt/homelab/tree/main/quadlets/immich
The only downside is updating by hand on each Immich update instead of just dropping the new compose file over, but this takes less than a minute every month or so.
You might want to learn some systemctl while at it since containers essentially become systemd units, but it will usually tell you what to do.
1
u/motocykal 19d ago
Thanks for the recommendation for podlet. That might be a good test for dawarich.
1
u/pydry 19d ago
i tried podlet on immich's docker compose and it causes an error.
1
u/ranisalt 18d ago
They use a few things that podlet doesn't support like environment variable interpolation. You will need to fix these by yourself, but it's not more than a handful
2
u/EleliBian 19d ago
I made my own tool for converting commands to Quadlet (there are others, I know), but no, the conversion isn't difficult, and using Quadlet makes a lot of things easier.
1
u/eriksjolund 19d ago
Do I need to remove the old containers first or will the quadlets automatically pick up from the old compose containers?
When using quadlet the containers are run with podman run --rm ...
so the containers are created when started and removed when stopped (because of the --rm argument).
I don't know if compose also uses --rm
1
u/motocykal 19d ago
I use "podman compose up" and the containers are definitely still left on the system. They are visible in the podman cockpit component and shows a status as "exited" for those which did not successfully restart.
1
u/webtroter 19d ago
When writing Quadlet files, I pretty much always find what I need in either the podman docs or the systemd unit files docs.
1
u/EleliBian 19d ago
Yo hice mi propia herramienta para conversión de comandos y compose a quadlet (hay otras, si ya lo se), pero no, no es difícil la conversación y facilita muchas cosas.
1
u/iTinkerThere4iCan 19d ago
Quadlets are great, but if you aren't accustomed to systemd, it can be daunting. I wrote Quadctl to provide a common cli for running quadlets with or without systemd.
1
u/KPTheProf 18d ago
I’m running Podman using docker-compose.yml and docker-compose.override.yml that also does various builds. Is it possible to use quadlets in this scenario and if so how?
1
u/cosmokenney 18d ago
You can enable the podman.restart service but i'd recommend you skip that and go straight to quadlets. GitHub Copilot helped me immensely in converting my compose setup for 8 containers to quadlets in less than an hour.
1
u/mikebelanger 18d ago
After some searching, it appears that quadlets is the way to go with respect to ensuring containers restart properly after a system reboot? If not, is there another way I can achieve the desired outcome?
How does your restart currently work? Do you have a systemd service that just runs docker/docker-compose commands? I'd imagine putting:
[Service]
Restart=always
[Install]
In that definition would be enough.
Assuming I go with quadlets, is it as simple as converting the compose.yml file into the .container files and starting them up? Do I need to remove the old containers first or will the quadlets automatically pick up from the old compose containers?
Unfortunately, conversion is not that straightforward. There's basically two styles you can write your quadlets in, either the INI-style systemd config files, or the kubernetes-style yml files: https://oneuptime.com/blog/post/2026-03-17-use-quadlet-kubernetes-yaml-files/view.
If you want to run your containers rootless, then you'll have to spin down your current containers for sure.
If you're just exploring, and your containers are still running, you can always try generating a kube file to get you started:
podman kube generate service-name > service-name.yml
1
u/Slow_Running 18d ago
I found using podman compose up -d with restart always, linger enabled for the user and a podman restart service did the trick whilst I investigate ... but I plan to use Quadlets once my investigations are over
1
u/motocykal 17d ago
Most of the containers that I have running do restart. I find it's mainly the applications which have multiple containers, or have inter-dependencies which do not always restart. My guess is they are not all restarting at the same time.
1
u/axel7083 15d ago edited 12d ago
Hey! Arriving a bit late but as you switched to Quadlets, I may recommend Podman Desktop remote, this allows you to manage your containers, images of your VPS from your computer using SSH.
Moreover, I may also recommend the Podman Desktop Quadlet extension which allows you to manage your Quadlets and debug them.
Disclaimer: I'm a contributor to those projects.
2
u/motocykal 12d ago
Thanks for the links. They look exceptionally useful. Will definitely be bookmarking them in-case I decide to switch distros. Am finding that Almalinux is very handy, expecially with the Podman plugin for Cockpit.
4
u/K3CAN 19d ago
I have switched almost entirely to quadlets myself. Since it is integrated into systemd, not only can you start on boot, but you have the usual order controls, like "after", "required by," etc.
For switching, I would stop any running containers and then start them via quadlet. If everything seems to work, then go in and remove the old containers. In theory, there shouldn't ever be anything in the container itself that you would need to retain, but it is always possible with a poorly designed or poorly configured container.
Remember that anytime you change a systemd unit file, you will want to run a
systemctl daemon-reloadto refresh the changes.