As described here, there are multiple changes required on the Dockerfile, in order to run Docker images on OpenShift.
The core changes are:
1) Image must run as non-root.
2) Image must run with an arbitrary UID, which requires permission on the runtime folders/files so OpenShift can read/write files with this arbitrary UID.
3) The USER entry on the Dockerfile should use the numeric UID, not the name of the user.
4) Volumes should only be declared when they are mandatory, not when they are optional.
5) The default command should point to a running state by default, to avoid redeploy the image once created. This is a special use case when the OpenShift UI is used to deploy the application.
6) Make sure that the main process runs at PID 1, and it properly process SIGTERM for graceful shutdowns.
As described here, there are multiple changes required on the
Dockerfile
, in order to run Docker images on OpenShift.The core changes are:
1) Image must run as non-root. 2) Image must run with an arbitrary UID, which requires permission on the runtime folders/files so OpenShift can read/write files with this arbitrary UID. 3) The
USER
entry on theDockerfile
should use the numeric UID, not the name of the user. 4) Volumes should only be declared when they are mandatory, not when they are optional. 5) The default command should point to a running state by default, to avoid redeploy the image once created. This is a special use case when the OpenShift UI is used to deploy the application. 6) Make sure that the main process runs at PID 1, and it properly process SIGTERM for graceful shutdowns.