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

Fix: USER (runAsNonRoot) #442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix: USER (runAsNonRoot) #442

wants to merge 1 commit into from

Conversation

till
Copy link

@till till commented Sep 2, 2023

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.

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).
@tianon
Copy link
Member

tianon commented Dec 11, 2023

See docker-library/memcached#79 (comment):

Thanks for the contribution!

I'd honestly rather not maintain this UID explicitly like this, especially since there's no functional difference between the two when actually running the image (and one is distinctly more user-friendly to read than the other). 😬

There are a few options here that don't require us to make/maintain any changes to the images:

  • run the image explicitly as the user (...)

  • maintain a short Dockerfile that's auto-built with just FROM memcached \n USER 11211:11211 (if it has to be baked into the image itself)

  • implement something like a mutating admission webhook on the cluster which can pull the image and resolve the UID/GID appropriately to then dynamically update the applied configuration appropriately (which I think is the most "Kubernetes" solution to this problem)

@till
Copy link
Author

till commented Dec 11, 2023

See docker-library/memcached#79 (comment):

Thanks for the contribution!
I'd honestly rather not maintain this UID explicitly like this, especially since there's no functional difference between the two when actually running the image (and one is distinctly more user-friendly to read than the other). 😬
There are a few options here that don't require us to make/maintain any changes to the images:

  • run the image explicitly as the user (...)
  • maintain a short Dockerfile that's auto-built with just FROM memcached \n USER 11211:11211 (if it has to be baked into the image itself)
  • implement something like a mutating admission webhook on the cluster which can pull the image and resolve the UID/GID appropriately to then dynamically update the applied configuration appropriately (which I think is the most "Kubernetes" solution to this problem)

Can you reconsider this? There is a functional difference when using this image on Kubernetes. A non-numeric user cannot be verified with runAsNonRoot. See this for implementation details.

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?

@till
Copy link
Author

till commented Apr 16, 2024

@tianon sorry to bug, but any thoughts?

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

Successfully merging this pull request may close these issues.

None yet

2 participants