[英]How to modify tomcat server.xml to run on port 8443 with self-signed certificate in docker
I am following this Link to create self-signed certificate: https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html 我正在跟踪此链接以创建自签名证书: https : //tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html
I need to do this using docker but, its telling me to modify the tomcat server.xml file on some path that doesnt exist. 我需要使用docker来执行此操作,但是它告诉我在不存在的某些路径上修改tomcat server.xml文件。 Again, as far as I understand there is no point in me making these changes locally.
同样,据我了解,我没有必要在本地进行这些更改。 I need to make the changes either in dockerfile or the dockerStartup.sh file I think.
我需要在我认为的dockerfile或dockerStartup.sh文件中进行更改。 Could someone please provide me with some guidance.
有人可以给我一些指导。 Thanks
谢谢
You will have to mount your modified file as a volume when running the container, for example: 运行容器时,必须将修改后的文件作为卷挂载,例如:
docker run -d -v ./server.xml:/path/to/my/config/on/the/container/server.xml --name my_tomcat_server myimagename
With that, the server will read the modified config file, as long as you mount it in the correct directory. 这样,服务器将读取修改后的配置文件,只要将其安装在正确的目录中即可。
You need to mount the server.xml externally from a Volume , also the self signed or for that matter any external certificates needs to be mounted from a volume to the internal desired path of the container. 您需要从Volume外部安装server.xml,也需要自签名,或者为此需要将任何外部证书从卷安装到容器的内部所需路径。
docker run -it --rm -p 8888:7080 \
-v /${HOST_PATH}/webapps:/usr/local/tomcat/webapps \
-v /${HOST_PATH}/server.xml:/usr/local/tomcat/conf/server.xml \
tomcat:8.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.