polar icon indicating copy to clipboard operation
polar copied to clipboard

Feature Request: Support user namespaced containers

Open nyonson opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. Podman (and maybe Docker?) now supports user namespaced containers. There are security benefits to running containers this way instead of depending on a root-ful daemon. User namespaced containers change how user/group ids are mapped between the host and container systems. This means that the USERID and GROUPID variables passed around in Polar's docker filers no longer work as expected in user namespaced containers and the containers fail to start.

Describe the solution you'd like I am not sure the best way to support user namespaced containers while not breaking current patterns, but ideally some setting could disable the USERID/GROUPID variables and let the standard mapping take over.

Additional context For now I think I can get around this by building my own containers which just drop the current entrypoint logic to map USERID/GROUPID.

nyonson avatar Aug 10 '21 22:08 nyonson

Thanks for pointing this out @nyonson. I was not aware of these user namespaced containers. The current way that Polar handles user permissions is not ideal, but it was the only way I could get it working across all 3 platforms at the time. I'll have to investigate more on Podman/Docker namespaces to see if it's possible to improve or simplify the implementation. Appreciate it 👍

jamaljsr avatar Aug 11 '21 18:08 jamaljsr

The part of the current implementation which doesn't play nice with rootless containers is how the user are created dynamically in the docker-entrypoint.sh script. That requires the containers to start out running as root in order to create the new users. Could we instead base the user creation into the Dockerfile and use the User field in the docker-compose definition?

nyonson avatar Sep 08 '21 21:09 nyonson

Could we instead base the user creation into the Dockerfile and use the User field in the docker-compose definition?

My bad @nyonson, I haven't had a chance to look into this. I don't know if this would be possible atm.

jamaljsr avatar Sep 20 '21 20:09 jamaljsr

I'm interested in trying to get this to work. Any tips to get started?

amackillop avatar Mar 23 '24 02:03 amackillop