openshift pod fails and restarts frequently

priyank picture priyank · Mar 2, 2016 · Viewed 11.7k times · Source

I am creating an app in Origin 3.1 using my Docker image.

Whenever I create image new pod gets created but it restarts again and again and finally gives status as "CrashLoopBackOff".

I analysed logs for pod but it gives no error, all log data is as expected for a successfully running app. Hence, not able to determine the cause.

I came across below link today, which says "running an application inside of a container as root still has risks, OpenShift doesn't allow you to do that by default and will instead run as an arbitrary assigned user ID."

What is CrashLoopBackOff status for openshift pods?

Here my image is using root user only, what to do to make this work? as logs shows no error but pod keeps restarting.

Could anyone please help me with this.

Answer

lvthillo picture lvthillo · Mar 2, 2016

The recommendation of Red Hat is to make files group owned by GID 0 - the user in the container is always in the root group. You won't be able to chown, but you can selectively expose which files to write to.

A second option: In order to allow images that use either named users or the root (0) user to build in OpenShift, you can add the project’s builder service account (system:serviceaccount::builder) to the privileged security context constraint (SCC). Alternatively, you can allow all images to run as any user.