-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman support #407
Comments
(copy/paste from a teams conversation, apologize for the bad formatting) one bit of info I should mention about the podman one: all of the malcolm docker images go through the same entrypoint, this script. the purpose of this script is, for the most part, to set up the uid/gid stuff inside the container to match what the user has specified in the config environment variables. Some containers have this environment variable PUSER_PRIV_DROP set to true (like this) to immediately drop privileges in that script, while others need to be root for just a bit longer and then drop privileges inside the container either inside a supervisord process or some other way in the startup code of that container. But the important part is that every single one of the containers actual runtime processes drops to the correct non-root user upon startup. This ensures, among other things, that all files created get created from the host (the machine running Docker) point of view with the correct file ownership: if user manny is running Docker and that UID is 1000, then all processes run under and all files are created with ownership 1000; if user seth is running it and his UID is 1001, all processes run under 1001 and ownership of files belongs to that UID. so the way docker and podman work is just a bit different: for docker, the PUID and PGID variables should be set to whatever your users' are, e.g., 1000 or whatever, and they'll get set appropriately inside the container. however, for rootless podman, it works a little bit different: by default, uid/gid 0 and 0 (or, in other words, root) map to the UID/GID of the user running podman. So for like 90% of the containers, this can just be solved by setting the variables in process.env to 0 and 0 and it will pretty much work. however, there are some containers that don't like this: for example, the opensearch container refuses to start if the UID/GID is set to zero, saying it's not safe to run as root. however, podman has a userns mode capability with keep-id (here are some examples) that I think will take care of the problem. in other words, I think the solution is to set process.env to be the same UID and GID as we would with docker, but use the keep-id mode to map it so 1000 inside the container is the same as 1000 outside the container (or whatever the UID is, it would need to work for whatever is set in that .env file). here is some other reading on userns modes. so one of the tricks will be how to set the --userns keep-id (or whatever the exact flag looks like) into the environment running podman via podman-compose or docker compose (i think both podman-compose and docker compose should be supported if possible, as both are valid options for running podman against docker-compose files). here are some things to look at:
Basically, it needs to work correctly for whatever the user's UID and GID from process.env are, and it needs to be able to do so ideally without modifying the docker-compose.yml file directly (ie., just pulling it from process.env) and it needs to not break existing docker-supported functionality |
Podman 5 is out which seems to have a bunch of improvements, I'd recommend we use that as a baseline (and, if there's anything it makes easier, making that a minimum requirement). |
I've started playing with this, and honestly the issues are very few:
|
… specifying container runtime (docker vs. podman) for idaholab#407
Here's a thread that's maybe working for the user namespace mapping stuff:
Need to 100% confirm this, but it looks good. Also need to make sure that this is ignored when in regular docker-compose mode. If not, we can add it on the fly, but that's less fun. |
See containers/podman#23347 for another issue. Trying to run via |
…privilege dropping afterwards works consistently, idaholab#407
I've got this in a pretty-much-working state, just going through and hand-checking the logs and whatnot to make sure everything is the way it should be. I still need to test live-capture as well. |
As expected live capture is failing, but everything else is working correctly as far as I can tell. |
I have determined that it's impossible to do the live network capture using rootless podman (probably rootless docker as well) because of the user namespacing. Even with tricks like I've added this to the documentation in a few of the places we mention podman:
|
I don't think there's any reason Malcolm couldn't run fine with rootless podman, particularly using the
--userns keep-id:uid=xxxx,gid=yyyy
option to map the current host user to a specific ID inside the container.Just need to work through it and resolve issues that crop up.
The text was updated successfully, but these errors were encountered: