Docker 启动Tomcat,访问首页出现404错误

发布于:2021-10-23 09:33:01

Docker 启动Tomcat,访问首页出现404错误



    使用命令: docker exec -it 运行的tomcat容器ID /bin/bash 进入到tomcat的目录进入webapps文件夹,发现里面是空的(tomcat默认的欢迎页面实际上放在的路径应该是:webapps/ROOT/index.jsp或者index.html)发现旁边还有个webapps.dist的文件,进入才发现原本应该在webapps文件中的文件都在webapps.dist文件中通过下面的命令修改相关文件的名称,使得Tomcat首页能够成功访问


[root@localhost jinjia523]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f7ddfece26dd tomcat "catalina.sh run" 39 seconds ago Up 38 seconds 0.0.0.0:8080->8080/tcp mytomacat
[root@localhost jinjia523]# docker exec -it f7ddfece26dd /bin/bash
root@f7ddfece26dd:/usr/local/tomcat# ls
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE README.md RELEASE-NOTES RUNNING.txt bin conf lib logs native-jni-lib temp webapps webapps.dist work
root@f7ddfece26dd:/usr/local/tomcat# mv webapps webapps2
root@f7ddfece26dd:/usr/local/tomcat# mv webapps.dist webapps
root@f7ddfece26dd:/usr/local/tomcat# ls
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE README.md RELEASE-NOTES RUNNING.txt bin conf lib logs native-jni-lib temp webapps webapps2 work

相关推荐

最新更新

猜你喜欢