tomcat - 为什么我的 tomcat docker 容器不部署 webapp?

标签 tomcat docker deployment

我只想启动一个简单的 tomcat docker 容器并将我的 warfile 装载到其中。
命令:
docker run --name tomcat_server -p 8080:8080 -p 8009:8009\
-v/c:/p/webapps/sample-webapp.war:/usr/local/tomcat/webapps/sample-webapp.war\
-d tomcat:8

但我总是收到 404 错误:

The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


容器启动后,我使用 docker exec 跳入其中,我只找到了 war 文件 sample-webapp.jar 而不是文件夹 /sample-webapp (因为它在我的“真正的本地”tomcat 上)

docker tomcat webapps 文件夹:

drwxr-x--- 3 root root 4096 Oct 10 08:42 ROOT
drwxr-x--- 14 root root 4096 Oct 10 08:42 docs
drwxr-x--- 6 root root 4096 Oct 10 08:42 examples
drwxr-x--- 5 root root 4096 Oct 10 08:42 host-manager
drwxr-x--- 5 root root 4096 Oct 10 08:42 manager
drwxr-xr-x 2 root root 40 Oct 19 10:55 sample-webapp.war


为什么tomcat不部署那个war文件?

非常感谢!

最佳答案

对于 Windows 下的卷,使用任一

-v C:/my/local/path:/my/container/path

-v/c/my/local/path:/my/container/path

并且您还必须在 Docker 设置中允许您的 C: 驱动器与 Docker 共享: Docker settings

关于tomcat - 为什么我的 tomcat docker 容器不部署 webapp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46828543/

相关文章:

tomcat - 统一的http错误页面

java - 如何使用 Maven 部署 HTML 和 WAR?

docker - nginx proxy_pass 导致 404 Not Found 页面

git - Heroku + Github 部署策略

web-services - 使用生产代码部署配置文件

maven - 为将在 tomcat 中运行的 Web 应用程序提供范围 "provided"的依赖项

Docker、Tomee、日志记录、标准输出、AWS

docker - 通过REST API在Artifactory中设置baseURL

visual-studio - Visual Studio 无法创建 docker 图像

java - Glassfish 4 自动部署 war 文件的部署顺序