I am new to CoreOS.
I am using podman for all my services.
I can not figure out how to get unless-stopped working as expected (after a reboot, start only the containers that were running before the reboot).
podman-restart.service only starts containers on always restart policy. Adding unless-stopped to it only makes it the same behavior as always.
I am trying for the past 2 weeks to find a working way to have the correct behavior with the help of Claude AI. Here is what I have so far:
You’d usually want each container individually managed as a systemd service, instead of manually managing them in podman and building custom logic for them to be restarted after reboot. Those services you then enable or disable through systemctl. The recommended way is writing Quadlet files for such podman services, instead of plain systemd services.
Use systemctl enable --now my-service to start a service and mark it to be started at boot too. Use systemctl disable --now my-service to stop and disable it.
If you want crashing services to restart automatically, use Restart=always in the [Service] section. Be sure to check out the RestartSec=, RestartSteps=, and RestartMaxDelaySec= options though, to prevent a burst of failed start attempts from breaking restart behavior. See “StartLimitIntervalSec=” in man systemd.unit.
I’ve built an abstractions for generating Quadlet services running as unprivileged users from a YAML based format and an example of how to use it, that might be of interest to you.
I’m unfortunately not familiar with sablier. Does it not allow starting and managing a statically configured set of containers? Explicitly specifying stuff like that in a config file and adapting it if something needs to change, sounds like the cleaner approach to me.
I already have all my software stack configured as docker-compose files. Reverse proxy, sablier configuration is defined as compose labels. All the networking is done through podman networks. Deployment and modifications of containers are all done automatically through compose and portainer when the git containing the docker compose is updated. For these reasons, and from what I understand about quadlets, it will not fit my use case which is to use only podman features as abstraction from the OS.
I appreciate a lot not having to touch anything OS or systemd related when adding or editing containers. I am just editing my compose, commit, and it’s automatically deployed and updated.
I am migrating from debian to fedora coreos.
Sablier will be using the podman socket. From what I understand, it can not manage statically configured containers.
What Claude AI is suggesting me to do (and that I am failing to implement) is to have systemd scripts that save a list of all the running containers at shutdown time in a file, to start them again after the reboot. But there may be another way.
Okay. Consider saving state whenever you make a change though, to avoid losing it when the system doesn’t shut down cleanly. If your tools don’t have the ability to specify hooks, writing wrapper scripts might work.
Other than that I see debugging your scripts/services step by step until they do what they are supposed to as the best way forward. Perform the script’s steps manually, add debugging outputs, inspect systemd journals, etc. until you find what’s wrong