简体   繁体   中英

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

I need to do this using docker but, its telling me to modify the tomcat server.xml file on some path that doesnt exist. 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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM