简体   繁体   English

如何在Docker中使用自签名证书将tomcat server.xml修改为在端口8443上运行

[英]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.

相关问题 如何使用自签名证书运行Docker容器 - how to run docker container with self signed certificate 如何使Drone Docker插件通过具有自签名TLS证书的自托管注册表进行身份验证 - How to make Drone Docker plugin to authenticate with a self-hosted registry having a self-signed TLS certificate Docker官方Tomcat映像修改Server.xml并将jar添加到lib文件夹 - Docker Official Tomcat Image Modify Server.xml and add jar to lib folder 用于Docker的auth URL的TLS自签名证书 - TLS self-signed certificate for auth URL for Docker 使用自签名证书将本地Docker映像推送到私有存储库 - Pushing a local Docker image to a private repository with a self-signed certificate 自签名证书在 docker 内无法用于容器之间的通信 - Self-signed certificate not work inside docker for communication among containers Keycloak:在 docker 中为 ldaps 设置自签名证书 - Keycloak: setting up self-signed certificate for ldaps in docker Docker nginx 自签名证书 - 无法连接到 https - Docker nginx self-signed certificate - can't connect to https JBoss/Keycloak 服务器:更新自签名服务器 SSL 证书 - JBoss/Keycloak Server: Update self-signed Server SSl certificate 如何使用自签名证书通过TLS将Docker应用程序包推送到私有注册表 - How to push a Docker Application Package to private registry via TLS using a self-signed certificate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM