Openshift deployment is unable to access jarfile "tes.jar"

5/14/2020

I am trying to deploy a springboot application in openshift environment. The deployment is finished but the pod is going into "CrashLoopBackOff" error.

Found the access error from the pod logs.

Error: Unable to access jarfile tes.jar

Dockerfile:

FROM openjdk:8-jre-alpine

WORKDIR /app/tes

ADD BUILD_FILE/tes.jar /app/tes


# Install below packages to get system resource
RUN echo "http://dl-1.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories
RUN echo "http://dl-2.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories
RUN echo "http://dl-3.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories
RUN echo "http://dl-5.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories

FROM openjdk:8-jre-slim
RUN apt-get update -y; \
 apt-get install -y --no-install-recommends iproute2 procps sysstat dumb-init bash coreutils sed; \
        rm -rf /var/lib/apt/lists/*

# Make port 8012 available to the world outside this container
EXPOSE 8012

# Define environment variable
ENV NAME tes

# Run .jar file
ENTRYPOINT ["java", "-jar", "tes.jar"]

I have applied the "anyuid" policy for the namespace,

oc adm policy add-scc-to-user anyuid -z default -n <namespace>

and set the selinux to permissive,

sudo setenforce permissive

Both of them does not work. Please let me know what is blocking the deployment to access the tar file.

-- Bhavani Prasad
kubernetes
okd
openshift

0 Answers