origin icon indicating copy to clipboard operation
origin copied to clipboard

Which UID/GID + permission in docker image ?

Open Locat opened this issue 8 years ago • 4 comments

Hey, I started using Openshift, but I'm still struggling with running images straight from Dockerhub.

I know I can bypass some restriction set by openshift using more relaxed SCC, however I'd rather not do it this way.

From what I gathered. my images must not run as root. However I'm not sure I completely understand how it should work (especially when there are persistent volumes used).

What are the best practices ? Should I use a random UID+GID (for example 1001:1001 ?) or should I go the 1001:0 way and add my user to the root group ? Which permissions should I set on my files folder. Must they be different if the data resides in a persistent volume ?

Thanks for your help

Locat avatar Jan 12 '18 21:01 Locat

@openshift/sig-security

0xmichalis avatar Jan 14 '18 01:01 0xmichalis

AFAIR our examples use "1001:0 way". Because UID may change, the only reliable way to be able to work with data in this case is to have files writable for the root group. You don't need to add a user to root group as it will have this group automatically.

php-coder avatar Jan 14 '18 01:01 php-coder

@Locat Here is a link to out best practices: https://docs.openshift.org/latest/creating_images/guidelines.html#openshift-specific-guidelines see the chapter "Support Arbitrary User IDs"

@bparees Did I miss something that should be mentioned here?

php-coder avatar Jan 15 '18 12:01 php-coder

Thank you for the submission. This type of question should be directed to the mailing list or stack exchange since it is not a bug or feature request.

As @php-coder mentions, group access is generally the way to go here. There are also facilities in SCC for controlling which groups can be used in the supplemental groups and fsgroup fields.

I'm going to close this but please reach out to the lists if there are more best practice questions or file a documentation bug (https://github.com/openshift/openshift-docs) if necessary. Thanks!

pweil- avatar Jan 15 '18 13:01 pweil-