我只想启动一个简单的 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
关于tomcat - 为什么我的 tomcat docker 容器不部署 webapp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46828543/