How to replace the "podman generate systemd" command since its deprecated #20218
-
The description states simply "Use Quadlet for running containers and pods under systemd.". In my current setup, I have Podman installed on several hosts, along with podman-compose. The entire setup runs under a rootless user configuration, with all containers operating as rootless as well. I have created a podman-compose.yml file fitting to my use cases and requirements.
I've been using Podman for a long time, especially appreciating the "podman generate systemd" command. The last update seem to move away from this key feature. I checked out Quadlet, but it doesn’t match the functionality and flexibility I'm used to. I don't want to write for every single container a Quadlet file and maintain it. I really like Podman, but the change might force me to consider switching to something else... maybe Docker. I'm open to Quadlet or other alternatives if they can cover the same ground. Is there something I've missed or another way to maintain the functionality I need within Podman's ecosystem? Can I automatically create Quadlet files somehow ? |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 51 replies
-
Maybe the command |
Beta Was this translation helpful? Give feedback.
-
Thank you @eriksjolund This would sound promising:
But then a little further down they state:
I would have to put a lot of time and effort in this now... while it was super simple and reliably before. Actually we wanted to discuss using Podman for my business projects. We've begun some test projects with it, but I'll have to stop these efforts next week. I just don't see how I could manage a big number of containers (and how they are geared together) using Quadlet files. |
Beta Was this translation helpful? Give feedback.
-
+1 for the use case of converting "podman [pod] run" to systemd units. I was planning to just roll my own systemd generator since the rate of breakage in podman is quite high in general; going by the pattern quadlet will probably be deprecated in 2-3 years. |
Beta Was this translation helpful? Give feedback.
-
I basically have the same question, I just also use https://github.com/containers/podman-compose. And I would love to deprecate that and move to Quadlet as that sounds very good for my use case. (I have just read about it.) Actually, let's see my current process… Current processI write So the process was like this, in short: What I wantNow, what is the migration path here? That would be awesome, because then I could switch to that and convert/keep my current configuration. |
Beta Was this translation helpful? Give feedback.
-
I read through all the previous discussion, but don't see a clear "call to action" here -- as an end user of podman, when I call and get back ..which to me, as an end user: "hey! you're doing something the old way which we will be retiring soon." -- when I get something like that I would expect there also to be a pretty concise and coherent message about what exactly I am supposed to be doing "the new way", which I am not just not groking from the discussion.. What exactly should I do to be running a container in podman via systemd in 2024 "the right/new way"? EDIT: I don't understand or really care what a quadlet is, but if I am supposed to use them to make podman run something in systemd, how I make one? |
Beta Was this translation helpful? Give feedback.
-
I still got no answer from the long discussion: How do I generate the systemd .service files from my existing compose.yml files? |
Beta Was this translation helpful? Give feedback.
-
My wasted afternoon - A user story: Like most here, I was left scratching my head by a mysterious "you're doing it wrong dummy" message displayed when running So down the rabbit hole I go. A search engine sends me to the official documentation which happily tells me how much easier Quadlets will make my life. I try curb my cynicism because maybe this time that claim is made it will actually be true? What follows in the documentation immediately makes a lie of that claim, for I'm told that instead of running a simple one-liner to generate a service file I now need to hand craft an intermediate configuration file that will then be used to generate that same service file. A sure fire win for abstraction and obfuscation. < OK. Deep breath. Must not lose temper, be civil and courteous ... > An example of this.container file is given, it looks simple and straightforward. Then again the example use case is about as basic and well useless as it gets. In digging deeper, much, much deeper it turns out that for a real world use case, with a real world container requiring networking, loading of external variables, local volume mounts and more this container file actually becomes a complete re-write of the compose.yaml in a brand new and different format with different syntax. By hand. < Sigh > This can't be right, they said this was better, that it was easier. Let's do some more research, what was this thing called again ... podlet? Sure let's search for podlet ... Oh, OK, not what I meant to search for, but brilliant find. It turns out there IS a way to generate these files from those existing standard compose.yaml and even a running container. Hang on, though, why isn't this standard?? Why isn't this the behaviour of podman generate systemd? Ahh, it's a third party effort - well, way to go k9withabone! Let me just run this -
Doh. Not installed, stupid me.
< Long exasperated sigh > Looks at time. Wasted 2 hours already to do what used to take 10 seconds. At this point I'll save you the odyssey of getting podlet installed except to say that container install wouldn't work due to mysterious permission issues, both methods of cargo install failed halfway through on F39 and finally got there another hour later using the binary download. Generated my container file, finally. Would have been faster by hand after all, but hindsight and at least this should be faster for all those other containers. Install my .container file to /etc/containers/systemd/ as the documentation tells me to do. Run systemctl daemon-reload. Almost there ... enable the service and ... < Scream > Back to the documentation. There's a second location given, that must be the answer. Moved the container file there, reload, still no .service file generated. < THUD Sound of head hitting desk > Run Realisation - later versions of podman may drop simple systemd functionality and significantly complicate my life. Solution:
Finally gets back to doing real work before boss asks why I've spent a whole afternoon on something that should have taken seconds. The End. |
Beta Was this translation helpful? Give feedback.
-
I don't think that using generate-systemd is a simple one-liner. The container needs to be created first, and then generate-systemd can generate service file based on that container. The service file must then be enabled/started. Using Quadlet, a file must be written once is then automatically loaded. Quadlet is especially beneficial for day-2 operations. Let's assume there is a fix for the .service generator. With generate-systemd, the files must be recreated manually while it's fully transparent using Quadlet without any manual intervention.
That is a fair point. Migrating from Docker Compose to Quadlet requires work and there is no silver bullet.
I do believe Quadlet is easier and better than generate-systemd once migrated. There is no trivial migration path though.
podlet is a community project and not part of Podman. We want to discourage the old workflow of creating containers/pods first and then generating .service files. I understand that this requires manual work migrating off generate-systemd. That is why we do not want to remove generate-systemd and decided to keep it. No new features but urgent bug fixes. Maybe we should add that to the deprecation notice when running generate-systemd?
That depends whether you want to run the .service as root or not. I believe we need to improve the docs to make the behavior clearer. That is very valuable feedback, thank you! |
Beta Was this translation helpful? Give feedback.
-
Adding a .container or a .service file to /etc/containers/systemd does't add anything to 'systemctl list-units' after doing 'systemctl daemon-reload'. I can relate to what was shared earlier by @jafd. It's a frustrating experience and a waste of time. |
Beta Was this translation helpful? Give feedback.
-
Yeah. I don't like the current implementation of 'this is deprecated'. I would most likely be fine with quadlets if there was an official built-in generator. (as someone pointed out, maybe quadlet will be deprecated in a few years, systemd won't).
As per other comments:
Again. I understand quadlet is super good for automation of environments if it's baked into podman. But it's not a good idea to NOT provide a generator command. It's way easier for me to generate a container with one line and then just create a service file based off an existing container rather than to read some documentation somewhere and to figure it out fully. |
Beta Was this translation helpful? Give feedback.
-
My original impression was podman was a runc/crun wrapper akin to docker's CLI, and that if I was doing k8s work I should be using the "cri-o" implementation, because podman was not the appropriate tool to be mashing into k8s, ergo shouldn't have all this k8s baggage since it's primary use case is not to be integrated with k8s, and cri-o would "go a level down" and just leverage crun/runc/docker and podman was just a "doable hack" that added more unnecessary overhead.. I guess I don't see the point in getting in a tizzy about shoehorning k8s features into podman and making it less user friendly. |
Beta Was this translation helpful? Give feedback.
As mentioned above, there is a project to generate Quadlets: https://github.com/k9withabone/podlet
I do not want to add that functionality to Podman as the ultimately goal is to move away from the workflow of generating systemd units based on existing containers. With Quadlet we aim at a Compose and K8s-like declarative workflow. Adding
podman generate quadlet
conflicts with that goal and it would imply that new Quadlet features had to be added there as well.The current strategy is to deprecate
podman generate systemd
. That means that no new features will be added togenerate systemd
but only bug fixes.