linux怎么查看本机内存大小
209
2022-10-28
Docker镜像分层构建
构建Tomcat镜像1.构建基础镜像mkdir /opt/dockerfile/system/ubuntuvim /opt/dockerfile/system/ubuntu/Dockerfile#Ubuntu Base ImageFROM ubuntu:20.04MAINTAINER shitouweb shitouweb@126.comRUN apt-get update && apt-get install -y wget libpcre3 libpcre3-dev openssl libssl-dev zlib1g-dev iproute2 net-tools iotop gcc g++ automake build-essential unzip tzdataRUN groupadd -g 2020 && useradd -u 2020 -g /opt/dockerfile/system/ubuntu/build-command.sh#!/bin/bashsudo docker build -t ubuntu-base:20.04 .2.构建JDK镜像mkdir /opt/dockerfile/web/jdk/jdk-8U251vim /opt/dockerfile/web/jdk/jdk-8U251/Dockerfile#JDK-8U251
FROM ubuntu-base:20.04 MAINTAINER shitouweb "shitouweb@126.com" ADD jdk-8u251-linux-x64.tar.gz /usr/local/src/ RUN ln -sv /usr/local/src/jdk1.8.0_251 /usr/local/jdk ADD profile /etc/profile ENV JAVA_HOME /usr/local/jdk ENV JRE_HOME $JAVA_HOME/jre ENV CLASSPATH $JAVA_HOME/lib/:$JRE_HOME/lib/ ENV PATH $PATH:$JAVA_HOME/bin RUN rm -rf /etc/localtime && ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
vim /opt/dockerfile/web/jdk/jdk-8U251/profile #可以在虚拟机中先搭建java环境变量然后复制profile文件即可,添加以下export JAVA_HOME=/usr/local/jdkexport CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JRE_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/binvim /opt/dockerfile/web/jdk/jdk-8U251/build-command.sh#!/bin/bashsudo docker build -t ubuntu20.04-jkd:8U251 .3.构建Tomcat镜像mkdir /opt/dockerfile/web/tomcat/tomcat-9.0.35vim /opt/dockerfile/web/tomcat/tomcat-9.0.35/DockerfileFROM ubuntu20.04-jkd:8U251LABEL shitouweb shitouweb@126.comADD apache-tomcat-9.0.35.tar.gz /appsRUN ln -sv /apps/apache-tomcat-9.0.35 /apps/tomcatvim /opt/dockerfile/web/tomcat/tomcat-9.0.35/build-command.sh#!/bin/bashsudo docker build -t ubuntu20.04-tomcat:9.0.35 .4.构建业务镜像mkdir /opt/dockerfile/web/tomcat/tomcat-app1vim /opt/dockerfile/web/tomcat/tomcat-app1/DockerfileFROM ubuntu20.04-tomcat:9.0.35
LABEL shitouweb shitouweb@126.com ADD server.xml /apps/tomcat/conf/server.xml ADD docker-1.tar.gz /data/tomcat/webapps ADD run_tomcat.sh /apps/tomcat/bin/run_tomcat.sh RUN chown -R /apps/ EXPOSE 8080 8005 CMD ["/apps/tomcat/bin/run_tomcat.sh"]
vim /opt/dockerfile/web/tomcat/tomcat-app1/buile-command.sh #!/bin/bashsudo docker build -t ubuntu20.04-tomcat0.0.35-webapps:1 .vim /opt/dockerfile/web/tomcat/tomcat-app1/run_tomcat.sh可执行文件必须增加执行权限,否则在容器中不能执行su -c '/apps/tomcat/bin/catalina.sh start' - -f /etc/hosts修改server.xml
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~