Could not access a running Docker Image of War (wi

2019-09-13 02:26发布

问题:

I have crated a docker image for a simple Java-Spring MVC War file, (Docker Config below). I am able to run the using docker run command and also I do not see any errors in the log or trouble uploading war into internal registry in Openshift-minishift. I was able to pull the image in my Openshift-minishift console.

#Docker Config

FROM tomcat:8.0.20-jre8

MAINTAINER ashok.gudise@github

ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH

RUN mkdir -p "$CATALINA_HOME"

WORKDIR $CATALINA_HOME

RUN chgrp -R 0 $CATALINA_HOME
RUN chmod -R g+rw $CATALINA_HOME
RUN find $CATALINA_HOME -type d -exec chmod g+x {} +

#RUN mkdir $CATALINA_HOME/app_conf
#ADD config $CATALINA_HOME/app_conf/

COPY build/libs/distributed-app-1.0.war $CATALINA_HOME/webapps/

#RUN sed -i -e 's/^shared.loader=$/shared.loader="${catalina.base}\/app_conf"/' $CATALINA_HOME/conf/catalina.properties

EXPOSE 8080

CMD ["catalina.sh", "run"]

-- OC Commands

oc new-project ext-project
oc login -u admin 
oc policy add-role-to-user admin ashokgudise ext-project
oc adm policy add-scc-to-group anyuid system:authenticated
oc policy add-role-to-group system:image-puller system:serviceaccounts:extproject
docker login -u ashokgudise -p XXXXXXXX 111.11.111.11:5000

docker push 111.11.111.11:5000/ext-project/dock-img-app:latest
docker tag dist-app:1.0 111.11.111.11:5000/ext-project/dock-img-app:latest

I do not see any unusual thing or exceptions in my pod's tomcat logs,also I can see exploded war in the pod's terminal.

I could not able to run the app with generated route,

回答1:

Finally I have resolved my issue, I've seen similar kind of issue that I faced here https://github.com/openshift/origin/issues/8702 .

Reason could be missing haproxy config for my generated router.

So I have uninstalled my minishift, and re-installed minishift using ansible-container

Now tomcat is up and running!!!