TOMCAT deployment using Dockerfile

First, the preparatory work

1, download and install docker

2, tomcat download archive

(1) I am here to download the apache-tomcat-9.0.8.tar.gz

download link
https://tomcat.apache.org/download-90.cgi

Figure

 

 

(2) extracting the command to obtain the decompressed packet, and renamed tomcat9 

xzvf apache, tomcat-908-tar targz
mv apache-tomcat-9.0.8 tomcat9

3, download jdk archive

(1) download jdk-8u131-linux-x64.tar.gz

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

(2) through command to extract, and that did not change as jdk18

tar -xzvf jdk-8u131-linux-x64.tar.gz
mv jdk-8u131-linux-x64 jdk18

 

Second, edit Dockerfile

# Use base image 
the FROM CentOS
 # Create a directory 
RUN mkdir -p / docker_home / local
 # to jdk files in the current directory folders to mirror 
the ADD tomcat9 / docker_home / local / tomcat9
ADD jdk18 /docker_home/local/jdk18
ENV JAVA_HOME /docker_home/local/jdk18/
ENV CATALINA_HOME /docker_home/local/tomcat9
The PATH the PATH $ ENV: $ JAVA_HOME / bin: $ CATALINA_HOME / bin
 # exposed port 8082
EXPOSE 8082
# Run tomcat startup 
CMD [ " /docker_home/local/tomcat9/bin/catalina.sh " , " RUN " ]

 

Third, build a mirror

docker build -t centos -f Dockerfile ./

 

Fourth, start the container

docker run -d -p 8082:8082 --name=tomcat9 centos

Fifth, use IP: PORT browser access

Guess you like

Origin www.cnblogs.com/yfacesclub/p/12083668.html