Start containers upon boot

Is there a way to get podman containers to start automatically after booting? If I log in the containers start but as soon as I log out they close. I’ve set them up using quadlet.

I’ve had this problem in the past when I generated my own .system files and it turned out to be a simple fix…

loginctl enable-linger $USER

Using quadlet, that command keeps the containers open after logging out but after a reboot they don’t run automatically, presumably because the containers get removed as soon as they are closed.

If anything, that command makes problems worse with quadlet because logging in doesn’t fire them up either. I have to start them manually.

Thank you

Do you have this in your systemd container file?
e.g. (~/.config/containers/systemd/foo.container)

[Service]
Restart=always

It sounds more like the opposite. When you log out, systemd user instance is stopped and all generated units are stopped and containers get removed (at least, looking at quadctl examples). When you reboot with lingering enabled, it is quite possible that generated units are not stopped as they should be and this prevents them from restarting properly.

Try booting with systemd.log_level=debug and look into logs. It may show something.

But I would say this is more the question to the podman community, it does not look openSUSE specific in any way.

Thank you for the replies guys. In the end, I just reinstalled MicroOS and it worked. I’ve no idea what is different since my last two installs but it now worked. All I do is create a user, mount my storage, cp my ‘containers’ directory to ~/.config and enable podman-restart for user. This time, it worked.

So for anyone finding this post in the future,

In .container file

[Service]
Restart=always

and

loginctl enable-linger $USER

and enable podman-restart.

…only took me about 3 weeks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.