We had "default" user in Dockerfile and entrypoint shell script , which need to be execute during run time. When we deployed this into Openshift cluster(4.6), pod is having different user and due to this entrypoint shell script is failing hence application is not coming up. Request you to suggest how to execute those shell scripts even with user in POD
-
What is this default user that you are referring too? Can you provide more details? Quick guess based on what you said would to use openshift [security context constraints](https://docs.openshift.com/container-platform/4.6/authentication/managing-security-context-constraints.html). – acid_fuji Nov 10 '20 at 09:04
1 Answers
Openshift provides security context constraints (SCC) to control permissions for pods. With them you are able to to control permissions/actions that a pod or collection of containers can perform and what resources they can access. Couple of things that SCCs allow an administrator to control:
- Whether a pod can run privileged containers.
- The SELinux context of the container.
- The container user ID.
- The allocation of an
FSGroup
that owns the pod’s volumes.- The configuration of allowable supplemental groups.
- Whether a container requires the use of a read only root file system.
- The usage of volume types.
SCCs are composed of settings and strategies that control the security features a pod has access to. If I understood correctly your questions you want to check the RunAsUser
strategies:
MustRunAs
- Requires arunAsUser
to be configured. Uses the configuredrunAsUser
as the default. Validates against the configuredrunAsUser
.MustRunAsRange
- Requires minimum and maximum values to be defined if not using pre-allocated values. Uses the minimum as the default. Validates against the entire allowable range.MustRunAsNonRoot
- Requires that the pod be submitted with a non-zerorunAsUser
or have theUSER
directive defined in the image. No default provided.RunAsAny
- No default provided. Allows anyrunAsUser
to be specified.
For more please have a look at the official openshift docs.

- 6,287
- 7
- 22