Docker在Centos下使用Dockerfile构建远程Tomcat和Jenkins镜像
镜像构建准备环境原料
构建CentOS Docker tomcat镜像
Dockerfile文件内容:
FROM centos:latest MAINTAINER boonya <boonya@sina.com> # now add java and tomcat support in the container ADD jdk-8u121-linux-x64.tar.gz /usr/local/ ADD apache-tomcat-8.5.16.tar.gz /usr/local/ # ADD tomcat-users.xml /usr/local/apache-tomcat-8.5.16/conf/tomcat-users.xml # configuration of java and tomcat ENV ENV JAVA_HOME /usr/local/jdk1.8.0_121 ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ENV CATALINA_HOME /usr/local/apache-tomcat-8.5.16 ENV CATALINA_BASE /usr/local/apache-tomcat-8.5.16 ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin # container listener port EXPOSE 8080 # startup web application services by self CMD /usr/local/apache-tomcat-8.5.16/bin/catalina.sh run
Dockerfile构建命令:
docker build -t boonyadocker/centos-tomcat:allow-remote .
构建CentOS Docker jenkins镜像
Dockerfile文件内容:
FROM centos:latest MAINTAINER boonya <boonya@sina.com> # now add java and tomcat support in the container ADD jdk-8u121-linux-x64.tar.gz /usr/local/ ADD apache-tomcat-8.5.16.tar.gz /usr/local/ ADD apache-maven-3.3.9-bin.tar.gz /usr/local/ ADD jenkins.war /usr/local/apache-tomcat-8.5.16/webapps/ # ADD tomcat-users.xml /usr/local/apache-tomcat-8.5.16/conf/tomcat-users.xml # configuration of java and tomcat ENV ENV JAVA_HOME /usr/local/jdk1.8.0_121 ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ENV CATALINA_HOME /usr/local/apache-tomcat-8.5.16 ENV CATALINA_BASE /usr/local/apache-tomcat-8.5.16 ENV MAVEN_HOME /usr/local/apache-maven-3.3.9 ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin:$MAVEN_HOME/bin # container listener port EXPOSE 8080 # startup web application services by self CMD /usr/local/apache-tomcat-8.5.16/bin/catalina.sh run
Dockerfile构建命令:
docker build -t boonyadocker/centos-jenkins:allow-remote .
镜像已上传:https://hub.docker.com/
纸上得来终觉浅,绝知此事要躬行。