1. Select the base image
Docker Pull Tomcat:7.0-jre8
2. Generate an HTTPS certificate
Keytool-genkey-alias Tomcat-keyalg Rsa-keystore Tomcat.keystore
[Email protected]:~/ssl# ls
Tomcat.keystore
3. Launch the Tomcat container and import the certificate
[Email protected]:/usr/local/tomcat# ls/tmp/
Tomcat.keystore
[Email protected]:/usr/local/tomcat# mkdir Keys
[Email protected]:/usr/local/tomcat# cp/tmp/tomcat.keystore keys/
[Email protected]:/usr/local/tomcat# ls keys/
Tomcat.keystore
4. Commit
Do not exit container on host commit
[Email protected]:~/ssl# Docker ps-a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d3a3c7964a89 Tomcat:7.0-jre8 "bash" seconds ago up to seconds 8080/tcp Determined_mahavira
[Email protected]:~/ssl# docker images;
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Tomcat HTTPS 5308378959ab about a minute ago 560.8 MB
5. Start and access
[Email protected]:~/ssl# Docker run--rm-ti-p 9099:8080 Tomcat:https
[Email protected]:~/ssl# Docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
532A4EF7EFCC Tomcat:https "bash" seconds ago up seconds 0.0.0.0:9099->8080/tcp Thirsty_bhaskara
Docker (11): Docker live deploy HTTPS for Tomcat site