From what I have seen, rootless podman seems to take more effort than rootful one. I want to make a more informed decision for the containers, so I would like to ask.
- What is a rootless podman good for? How much does it help in terms of security, and does it have other benefits?
- One of the benefits commonly mentioned is for when container is breached. Then, running container on sudo-capable user would give no security benefits. Does it mean I should I run podman services on a non-privileged user?
Thank you!
A rootless container is good for security.
A lifetime old basic rule is never run anything as root, not even your podman :)
I only ever use rootless podman jn my system and I fond it pretty easy to actually run: zero effort whatsoever.
Why you say it’s complicated?
Yes I always create one unprivileged user (not even in the sudoers or wheel group ofc) for every service I containerize. And create a dedicated network for the service too.
It only takes a few lines in a normal docker compose yaml.
Also I use docker compose on podman, yes docker compose not podman compose.
Edit2: refer to this post of mine on how installed immich on rootless podman https://wiki.gardiol.org/doku.php?id=services%3Aimmich as you can see, the most complex part is… Useradd & mkdir LOL
Edit: also podman play nice with iptables and nft (which should be always preferred nowadays) instead docker can mess your system good, and don’t work with nft tables, unless quirks quirks…
- What is the benefit of creating users for every service? Wouldn’t one be sufficient?
- Also just out of curiosity, why not in sodo’ers list?
this post of mine
You have a typo in the title for the section about backups.
In that post you use the compose format. Have you used quadlet? My understanding is that’s the “preferred” way to do things, I’ve also had some issues and am trying to decide if it’s worth it. Any thoughts?
No, quadlet seems to require systemd and I run OpenRC.
I run 50+ containers with rootless Podman compose (on CoreOS) and haven’t encountered any unsolvable issues so far.
I’ve never tried quadlets but haven’t found a need or any driving reason to do so.
This answers all of your questions: https://www.redhat.com/en/blog/user-flag-rootless-containers
So the best defense plus ease of use is podman root assigning non-root UIDs to the containers. You can do the same with Docker, but Docker with non-root UIDs assigned still caries the risk of the root-level Docker daemon being hacked and exploited. Podman does not have a daemon to be hacked and exploited, meaning root Podman with non-root UIDs assigned has no downsides!
Thanks a lot for on-point answer! I wish the answered in the issue wrote a blog post, it would have been of great help.
I wish too for an in-depth blog post, but the github answer is at least succinct enough
Rootless podman means that it is less likely to bork the system. It is also nice to have per user containers.
Another benefit is that you can run podman in a service user. This makes sandboxing much easier.
One of the main advantage of podman is that, it respects the firewall rules. Docker don’t do that. Also having rootless podman means if somehow the container went rogue, it cannot have access to your root directory and perform malicious actions.
Also podman is a drop in replacement for docker. It does not need much configurations to setup. If you need compose, you might need to install podman-compose as well.
I always hear podman is a drop in replacement, but every time I try most of my stack doesn’t work. Permissions seem to be the issue most of the times, even when I create new volumes. I will try again in a few years probably, but I’m not holding my breath