简体   繁体   English

删除根后如何访问部署在Tomcat Docker容器中的War File Build

[英]How to access War File Build deployed in Tomcat Docker Container after deleting root

my docker file: 我的docker文件:

FROM tomcat

MAINTAINER "Shan Khan <xxx@gmail.com">

RUN ["rm", "-rf", "/usr/local/tomcat/webapps/ROOT"]

COPY ROOT.war /usr/local/tomcat/webapps/

CMD ["/usr/local/tomcat/bin/catalina.sh", "run"]

running as: 运行为:

sudo docker build -t webserver
sudo docker run -it --rm -p 8080:8080 webserver

tomcat is running but im unable to access in the localhost:8080 or localhost:8080/ROOT tomcat正在运行,但无法访问localhost:8080或localhost:8080 / ROOT

When I was doing this for a work project I seem to remember having to deploy the app to the Tomcat root. 当我为一个工作项目执行此操作时,我似乎记得必须将应用程序部署到Tomcat根目录。

Deploying my application at the root in Tomcat 在Tomcat的根目录部署我的应用程序

So basically you would need to add some steps to your Dockerfile to accomplish this. 因此,基本上,您需要向Dockerfile添加一些步骤来完成此操作。

instead of using CMD ["/usr/local/tomcat/bin/catalina.sh", "run"] , try to do it as ENTRYPOINT ["/usr/local/tomcat/bin/catalina.sh", "run"] 而不是使用CMD ["/usr/local/tomcat/bin/catalina.sh", "run"] ,尝试以ENTRYPOINT ["/usr/local/tomcat/bin/catalina.sh", "run"]

If this do not resolve your problem, try to see the logs. 如果这样做不能解决您的问题,请尝试查看日志。 In the logs you will see something like deploying webapp ROOT . 在日志中,您将看到类似deploying webapp ROOT If you do not see this logs but you get server startup took ***ms , then try to check war file locally or see if there are some errors popping up in catalina.out file inside logs folder by connecting to the docker container. 如果没有看到此日志,但是server startup took ***ms ,请尝试在本地检查war文件,或者通过连接到docker容器查看logs文件夹内catalina.out文件中是否弹出一些错误。 (docker ps- command to check the docker container running your dockerfile) (docker ps-命令检查运行您的dockerfile的docker容器)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在docker容器的tomcat 7中部署war文件 - how to deploy war file in tomcat 7 of docker container war文件如何在docker容器上的tomcat中创建目录 - How does war file creates directory inside tomcat on docker container 如何在tomcat docker容器中部署多次战争? - how to deploy multiple war in tomcat docker container? 部署不同应用程序的多次war时,tomcat容器如何区分要读取的war文件的web.xml - how does tomcat container differentiate which web.xml of war file to read when multiple war of different application is deployed 在tomcat Docker容器上部署.war - Deploy .war on tomcat Docker container 部署特定的.war文件后,Apache Tomcat将无法完成启动 - Apache Tomcat will not complete startup after a certain .war File is deployed 如何访问已部署的战争文件? - How do I access deployed war file? Tomcat 部署 WAR 文件,但应用程序未在 docker 容器中启动 - Tomcat deploys WAR file but application doesn't start in a docker container 如何在Spring Boot应用程序中启用HTTPS,该应用程序在Tomcat中作为WAR文件部署? - How to enable HTTPS in a Spring Boot application, deployed as WAR file in Tomcat? 如何从tomcat服务器中已部署的WAR文件中获取完整的URL - How to get the full URL from deployed WAR file in a tomcat server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM