My image runs without issue via the docker command line, but does not run on OpenShift Container Platform

Solution In Progress - Updated -

Issue

The following is the dockerfile and run script for an application image. There is no problem building the image and one can run it with no issues using the docker run command as a root user. However, the image will not run on the OpenShift Container Platform.

Why won't this image run on OCP?

The following is the dockerfile for the image:

FROM rhel7:latest
MAINTAINER user1@example.com
COPY ./rhel7-ga.repo /etc/yum.repos.d/rhel7-ga.repo
COPY ./epel.repo /etc/yum.repos.d/epel.repo
ENV http_proxy="http://webproxy.example.com:8080"
ENV https_proxy="https://webproxy.example.com:8080"
RUN yum --nogpgcheck install wget -y \
        && yum --nogpgcheck install docker -y \
        && yum --nogpgcheck install unzip -y \
        && useradd -ms /bin/bash user1
COPY ./classpath.list /home/user1/classpath.list
COPY ./initscript.sh /home/user1/initscript.sh
RUN chmod +x /home/user1/initscript.sh
WORKDIR /home/user1
CMD ["/home/user1/initscript.sh"]

The following is docker command run as the root user which works as expected:

# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /xenv:/xenv
-e ZIPURL="someurl/DockerFiles.zip" \
-e ZIPNAME="DockerFiles.zip" \
Imagename:tag

The following is the script executed by the RUN directive. The docker run command executes this script when the command is run as the root user without any problem.

# cat initscript.sh
chown user1 /var/run/docker.sock
su user1 <<'EOF'
wget $ZIPURL
unzip $ZIPNAME -d Build
docker build –t Image:tag Build [Build folder has dockerfile]
docker tag Image:tag somerepo:5000/Image:tag
docker push somerepo:5000/Image:tag

Why won't this image run under OpenShift Container Platform?

Environment

Red Hat OpenShift Platform (all versions)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.