"No such file or directory" error when running Docker image on OpenShift but not when doing "docker run" "No such file or directory" error when running Docker image on OpenShift but not when doing "docker run" kubernetes kubernetes

"No such file or directory" error when running Docker image on OpenShift but not when doing "docker run"


Is it possible that it is an issue with permissions?

Unless something has changed...for better security OpenShift by default runs containers using a user with random UID; that user is a member of the root group.

So, in addition to the command @Rico suggested to be added to Dockerfile, I would add:

RUN mkdir -p /opt/app/log \ && chown -R :root /opt/app/log \ && chmod -R 0775 /opt/app/log

This blog article has more info about running Docker containers with non-root users or random user IDs. (Disclaimer: I am affiliated with that web site)


${user.dir} is probably different when you run oc and when you run docker.

I'd start by checking that value in both environments.

In the case of oc it obviously doesn't exist in the containers so one workaround is to create a container from MyImage that has it.