-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
[FEATURE] Docker user settings #539
Comments
Can you describe what happens? Or share the output? |
if I try to create a library with out having the correct permissions I get this error:
|
So it seems using |
For what it is worth, I had to disable entry point script when configuring rootless container under podman. It was the most difficult part to figure out with stump image. Please, take a note of comment below See complete configuration for all of the contextual data: #512 Podman configuration highlights:
|
Sounds like there should be some additional configuration options for the entrypoint script so folks don't have to have custom workarounds 🙂 I'll try and look into what might be useful to configure at this step sometime soon |
Point 1 My podman experience made me think that stump image might be easier to manage if entrypoint script did not exist. It is an example of getting more with less effort. Instead of trying to override or parametrize the script, omitting the script allows end user to apply engine specific features of running rootless, if necessary. Point 2 When I tested stump I run other images to compare rootless environments and I found that stump image was behaving differently from other images I tested. Which sent me into hours of figuring out why this image behaved differently. In the end it was not so much I would speculate, that removing configuration Use command to inspect image and then locate Config section with User:0 in it: podman image inspect docker.io/aaronleopold/stump:0.0.9 | less Examples I found that simple images that don't try to manage UID and GID are easy to control from rootless perspective. Examples:
Images that attempt to manage UID and GID are actually hard to control and require inspection of what they do:
Thoughts on Sharing Actually, explicit control of UID and GID at host level is only important in one case: sharing host file system with container application. There are 2 types of sharing:
I am looking at the problem when SELinux environment is enabled (Fedora, Alma Linux, etc). Sharing among containers is taken care off by containerization and volume sharing with Z and z options. Sharing with Samba seems to have its own option, but it did not work for me as expected. In the end sharing with native apps is when we try to control UID and GID. In my case I decided that sharing with native apps like samba can be very difficult especially in case of write access. My solution was to switch from native Samba, to containerized rootful Samba to reduce the complexity and to rely on container sharing. Final Thoughts Due to all of the above complexity I would recommend that simplest solution is not to try to manage UID and GID of the service application. Let the administrator set what they want containerized application to run as and be done with it. It is relatively easy for someone to derive an image and to configure UID and GID however they want if original image had not attempted to manage its users. This resource is one of the best on the topic of identifying what process application runs as Understanding root inside and outside a container. The topic of controlling user is vast and has a lot of fine detail. This is just a starting point: Controlling user of containerized application. |
The cause of the "permission denied" above is line in entrypoint.sh script: Line 23 in a2c4280
addgroup -g $PGID $GROUP
adduser -u $PUID -G $GROUP -D -H $USER The above lines require When container engine switches user id to non-root, then the above lines break, which probably causes other bad effects, because specifying PUID and PGID environment variables no longer has effect in
Now we have image that is running under a specific UID and GID, but it does NOT have entries for these UID and GID in That's the core of the problem when trying to manage user and group using container options for user. The simplest not to deal with different cases is not to deal with any of the cases and to have no entrypoint logic related to user management. I kind of arrived to the same conclusion from two different perspectives. |
Is your feature request related to a problem?
Docker allows to set the user directly without the environment, which is preferable. As it makes it more secure and less complex.
Describe the solution you'd like
Additional context
Currently setting user with "user: 1000:1000" breaks for me.
The text was updated successfully, but these errors were encountered: