Skip to content
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

Using unprivileged users #277

Closed
jaxxstorm opened this issue Jan 16, 2019 · 3 comments
Closed

Using unprivileged users #277

jaxxstorm opened this issue Jan 16, 2019 · 3 comments

Comments

@jaxxstorm
Copy link

I'm trying to modify a docker image using the distroless base image. I added a USER directive to run as the binary, and as expected the run CMD failed due to the user not existing.

According to #235 it should be easy to override, but adding the user isn't actually possible because you can't RUN anything because of the lack of a shell.

How should one add another user here?

@chanseokoh
Copy link
Member

chanseokoh commented Jan 23, 2019

On Linux, you would normally use useradd and groupadd (e.g., like this), but of course, distroless doesn't have them, not to mention a shell.

I believe all you need is to have the right entry in /etc/passwd (and /etc/group if applicable), so I guess you can supply a custom passwd file.

@jaxxstorm
Copy link
Author

Yeah makes sense, thanks

@chanseokoh
Copy link
Member

Oh, I forgot to say this. If it is fine to use a uid (i.e., number) and you don't have to use a name (like myname), you don't necessarily have to add a user, for example, if all you want is to run your application inside the container as a non-root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants