-
Notifications
You must be signed in to change notification settings - Fork 444
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
Fix USER switching in Docker #1199
Conversation
Refers sbt#1198. In attempting to switch to the `daemonUser` we are instead switching to the hardcoded uid 1001. If the daemon user exists with a different uid then the docker container default user is incorrect. Correcting the `makeUser` function to switch to the username specified by `daemonUser` instead of the static uid.
cc @jw3 |
The can you have a look? If you need help running the tests take a look at the CONTRIBUTING.MD |
Sounds like an issue in the category of working on OpenShift vs working in other places. OpenShift doesn't need the user to exist at all, but that doesn't usually play well elsewhere. @kunalkapoor a reference to a public Docker image that demonstrates the issue out of the box would help. |
I used numeric UID in #1190 based on the OKD Creating Images Guidelines. (OKD, The Origin Community Distribution, is an open source fork of Kubernetes by Red Hat, which powers OpenShift):
Having said that, I think the issue brought up by @kunalkapoor in #1198 is totally fair, and I don't think non-OpenShift users would have to suffer from any drawbacks. I continue to seek for the middle ground where the Docker image is friendly to OpenShift by default. Also, it seems the numeric |
From what I gather, this issue is unrelated to the docker image used. You can try to reproduce this using any docker image as long as you have a "daemon" user already created in that image with a uid that is not 1001. Or else, we could use any random image and add docker commands to create the "daemon" user before sbt-native-packager docker commands are added. An example excerpt of a build.sbt:
Will result in a Dockerfile like below:
The above results in a daemon user with uid 6 being created but it switches to uid 1001 which doesn't exist in the system. If we must switch to uid for OpenSwitch users, then can we dynamically determine the uid of the daemon user and use that instead if it already exists? I'm not sure if that's possible. But an alternative might be to expose the |
There's a setting called |
Here's my proposal - #1200 |
Closing this as it is not the correct solution. #1200 seems better suited to fix the problem. |
Refers #1198.
In attempting to switch to the
daemonUser
we are instead switching to the hardcoded uid 1001. If the daemon user exists with a different uid then the docker container default user is incorrect. Correcting themakeUser
function to switch to the username specified bydaemonUser
instead of the static uid.