docker writes an introduction to Dockerfile that makes a new image on an existing tomcat image

  • 2020-05-17 07:03:17
  • OfStack

If you need to replace or add a file to the old tomcatimage to form a new image, you need to do 1 operation in dockerfile


FROM old_tomcat
# You can use it here docker Official mirror image , The following descriptions are examples based on this 
MAINTAINER ******************
# If you need to replace an existing configuration file or script  
ADD web.xml /usr/local/tomcat/webapps/manager/WEB-INF/ 
ADD tomcat-users.xml /usr/local/tomcat/conf/ 
ADD server.xml /usr/local/tomcat/conf/ 
ADD catalina.sh /usr/local/tomcat/bin/ 
ADD  Need to fight image In the war The package name .war /usr/local/tomcat/webapps/
EXPOSE 8080 
CMD ["/usr/local/tomcat/bin/catalina.sh","run"]

then


docker build -t new_tomcat .

1 is formed by the modified new mirror, start the new image of a container, add war already early in the container, don't need to map the host host directory to/usr/local/tomcat webapps /


Related articles: