使用DockerFeile生成镜像,里面包含了tomcat,jdk。最后启动容器成功,访问tomcat失败!
DockerFile文件内容【FROMcentosMAINTAINERxzmadmin<xzmadmin@163.com>COPYreadme.txt/usr/local...
DockerFile文件内容【FROM centosMAINTAINER xzmadmin<xzmadmin@163.com>COPY readme.txt /usr/local/readme.txtADD jdk-8u251-linux-x64.tar.gz /usr/local/ADD apache-tomcat-9.0.35.tar.gz /usr/local/RUN yum -y install vimENV MYPATH /usr/localWORKDIR $MYPATHENV JAVA_HOME /usr/local/jdk1.8.0_251ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarENV CATALINA_HOME /usr/local/apache-tomcat-9.0.35ENV CATALINA_BASH /usr/local/apache-tomcat-9.0.35ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/binEXPOSE 8080CMD /usr/local/apache-tomcat-9.0.35/startup.sh && tail -F /usr/local/apache-tomcat-9.0.35/bin/logs/catalina.out】构建镜像命令【docker build -t diytomcat .】新建容器命令【docker run -it -p 8090:8080 --name xzmdocker -v /home/kuangshen/build/tomcat/test:/usr/local/apache-tomcat-9.0.35/webapps/test -v /home/kuangshen/build/tomcat/tomcatlogs:/usr/local/apache-tomcat-9.0.35/logs diytomcat /bin/bash】
展开
1个回答
2020-07-02
展开全部
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询