-
Notifications
You must be signed in to change notification settings - Fork 609
Fix: USER (runAsNonRoot) #442
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
base: master
Are you sure you want to change the base?
Conversation
Supply the numeric uid/gid of the user/group created early in the Dockerfile. This is to ensure that (on k8s) runAsNonRoot works as expected because the username could indeed map to root (uid 0).
See docker-library/memcached#79 (comment):
|
Can you reconsider this? There is a functional difference when using this image on Kubernetes. A non-numeric user cannot be verified with Adjusting this, would indeed require less work downstream. You also already create a user/group with a specific UID (a few lines up), so it seems there's nothing "extra" to maintain? |
@tianon sorry to bug, but any thoughts? |
I apparently just made a duplicate of this request at #547 This issue is a real concern. User do not want to "maintain a short Dockerfile" just to set the user to a numeric value. That's a lot of maintenance headache. Other projects have made this change, ex nodejs/docker-node#2185 Can docker please make this change as well? |
Why not set the user explicitly in your Kubernetes YAML instead? Then you control the numeric ID explicitly, which is also really important if you want to be able to control the persistent storage / permissions. |
Specific to this repository, and the only tags of this repository that use a non-root
|
Why should one have to do so? Besides kubernetes, security tools flag USER with a username. Using USER with a username is just more difficult to use, especially for security conscience use cases. Plenty of other projects are using numeric uids. Why resist following that widespread practice here? |
@tianon I think I linked you to the code that produces an error with non numeric user/group from the image. Not sure what other mapping you are suggesting that people do downstream. |
I'm suggesting using https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ spec:
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
supplementalGroups: [4000] (Setting the user you want to run as explicitly will be much more secure in practice than relying on the image to do so.) |
I set both of these usually. |
How is that more secure? The situation right now is that users need to do more work to achieve the same result. That's not good practice, security related or otherwise. Simplicity is key feature of security. |
Supply the numeric uid/gid of the user/group created early in the Dockerfile. This is to ensure that (on k8s) runAsNonRoot works as expected because the username could indeed map to root (uid 0).
For context, I am using dind(-rootless) on a k8s cluster.