OpenShift 4.3.3, keep getting root error with containers

3/12/2020

I just downloaded OpenShift 4.3.3 and trying out the free trial. I am getting a root problem when I try to run containers in OpenShift.

Warning alert:Image runs as root
Image alpine runs as the root user which might not be permitted by your cluster administrator.

If I try running this container anyways, it alternates between Completed and CrashLoopBackOff error. The funny thing is, I am the only user and I have admin privileges on my account. I found a solution for OpenShift 3 where I run oc login -u system:admin and it will ask me for a password before telling me:

error: username system:admin is invalid for basic auth

To recreate: Developer view -> Add -> Container Image -> Image name = alpine -> defaults for everything else -> Create

-- Hustlin
containers
docker
kubernetes
openshift

1 Answer

3/13/2020

By default, Openshift runs containers as a non-root user. It looks like your image requires you to run it as root. You should update the security context permissions of the user and namespace. e.g.

oc adm policy add-scc-to-user privileged -z default -n <YOUR_NAMESPACE>
-- lakshman.pasala
Source: StackOverflow