站酷网下载,企业网站只用静态页,同城信息平台推广,国字类型网站有哪些内容镜像制作#xff0c; nginx的源码包 把nginx源码拷贝到容器内 编译要用到gcc make , 以及扩展工具 pcre openssl # pcre perl compatibal regulaer expression 刚开始#xff0c;可以两个终端#xff0c; 一个手工操作(编译安装、拷贝、环境变量等)#xf… 镜像制作 nginx的源码包 把nginx源码拷贝到容器内 编译要用到gcc make , 以及扩展工具 pcre openssl # pcre perl compatibal regulaer expression 刚开始可以两个终端 一个手工操作(编译安装、拷贝、环境变量等) 一个写Dockerfile 把手工操作的指令转换成Dockerfile ./configure 配置的时候有两个核心参数 ]# ./configure --help | grep pcre--without-pcre disable PCRE library usage--with-pcre force PCRE library usage--with-pcreDIR set path to PCRE library sources--with-pcre-optOPTIONS set additional build options for PCRE--with-pcre-jit build PCRE with JIT compilation support]# ./configure --help | grep ssl--with-http_ssl_module enable ngx_http_ssl_module--with-mail_ssl_module enable ngx_mail_ssl_module--with-stream_ssl_module enable ngx_stream_ssl_module--with-stream_ssl_preread_module enable ngx_stream_ssl_preread_module--with-opensslDIR set path to OpenSSL library sources--with-openssl-optOPTIONS set additional build options for OpenSSL$PATH 是指令寻址变量可执行命令全是依靠这个变量来查找的 要是变量里面能找到命令就可以直接执行要是找不到就不能执行 把nginx的目录加到变量里面就可以了。 export PATH${PATH}:/usr/local/nginx/sbin # 拼接 Dockerfile文件中把nginx放在前台执行 CMD [nginx, -g, daemon off;] 多阶段镜像制作就是先做一个nginx编译好的包然后利用这个包做一个nginx镜像 java的软件需要 git pull 下载代码 maven 编译 这时候才出来软件包。 然后才能制作镜像 这个叫多阶段镜像制作。 docker to docker 就是多阶段镜像制作镜像制作的多个阶段 通过as参数给容器起名字 ~]# cat nginx/Dockerfile
FROM mylinux:latest as builder
ADD nginx-1.22.1.tar.gz /
WORKDIR /nginx-1.22.1
RUN dnf -y install gcc make pcre-devel openssl-devel
RUN ./configure --prefix/usr/local/nginx --with-pcre --with-http_ssl_module
RUN make make install
RUN echo this is for nginx test /usr/local/nginx/html/index.htmlFROM mylinux:latest
RUN yum -y install pcre-devel openssl-devel yum clean all
COPY --frombuilder /usr/local/nginx /usr/local/nginx
ENV PATH${PATH}:/usr/local/nginx/sbin
WORKDIR /usr/local/nginx
EXPOSE 80/tcp
CMD [nginx, -g, daemon off;]~]# docker inspect web | grep 172
Gateway: 172.17.0.1,
IPAddress: 172.17.0.2,~]# curl http://172.17.0.2
this is for nginx test 上面的容器里面进行编译把编译好的软件包拷贝到下面的镜像里面进行配置制作镜像 单阶段做的话镜像会比较大。 为了把镜像做的更加精简更加小所以采用多阶段制作镜像 就不把编译工具放在镜像里面。 编译工具就是编译工具镜像制作就是镜像制作 这个就是多阶段镜像制作。 两个阶段第一个阶段编译第二个阶段镜像制作。 两个阶段合起来只需要源码和Dockerfile就可以完成镜像制作。 部署java程序的时候经常用到。 java的所有程序都得maven一下不maven编译的话不是jar包运行不了。 所有的java程序都有一个编译包 多阶段制作镜像的好处是上面的编译可以用的 和下面制作镜像的时候用的不是同一个镜像。 上面的镜像可能是有编译工具的代码拉下来直接编译就行。 下面的打完包直接运行跟上面的没关系。 多阶段制作镜像也叫docker to docker能熟练运用可以快速做出自定义镜像方便适用于生产环境。
文章转载自: http://www.morning.qjlnh.cn.gov.cn.qjlnh.cn http://www.morning.kszkm.cn.gov.cn.kszkm.cn http://www.morning.zrks.cn.gov.cn.zrks.cn http://www.morning.bqwnp.cn.gov.cn.bqwnp.cn http://www.morning.qjdqj.cn.gov.cn.qjdqj.cn http://www.morning.rggky.cn.gov.cn.rggky.cn http://www.morning.xsctd.cn.gov.cn.xsctd.cn http://www.morning.nkqrq.cn.gov.cn.nkqrq.cn http://www.morning.tcsdlbt.cn.gov.cn.tcsdlbt.cn http://www.morning.zwwhq.cn.gov.cn.zwwhq.cn http://www.morning.qzglh.cn.gov.cn.qzglh.cn http://www.morning.jikuxy.com.gov.cn.jikuxy.com http://www.morning.yhrfg.cn.gov.cn.yhrfg.cn http://www.morning.qbfwb.cn.gov.cn.qbfwb.cn http://www.morning.ypktc.cn.gov.cn.ypktc.cn http://www.morning.ypcd.cn.gov.cn.ypcd.cn http://www.morning.mszls.cn.gov.cn.mszls.cn http://www.morning.hrqfl.cn.gov.cn.hrqfl.cn http://www.morning.mjctt.cn.gov.cn.mjctt.cn http://www.morning.muniubangcaishui.cn.gov.cn.muniubangcaishui.cn http://www.morning.zqsnj.cn.gov.cn.zqsnj.cn http://www.morning.gfjgq.cn.gov.cn.gfjgq.cn http://www.morning.zlnf.cn.gov.cn.zlnf.cn http://www.morning.wtxdp.cn.gov.cn.wtxdp.cn http://www.morning.fqqcd.cn.gov.cn.fqqcd.cn http://www.morning.mrfgy.cn.gov.cn.mrfgy.cn http://www.morning.hnkkm.cn.gov.cn.hnkkm.cn http://www.morning.sxygc.cn.gov.cn.sxygc.cn http://www.morning.ryxdf.cn.gov.cn.ryxdf.cn http://www.morning.dlurfdo.cn.gov.cn.dlurfdo.cn http://www.morning.bndkf.cn.gov.cn.bndkf.cn http://www.morning.wwkft.cn.gov.cn.wwkft.cn http://www.morning.pjxlg.cn.gov.cn.pjxlg.cn http://www.morning.fgqbx.cn.gov.cn.fgqbx.cn http://www.morning.kdnbf.cn.gov.cn.kdnbf.cn http://www.morning.xtqld.cn.gov.cn.xtqld.cn http://www.morning.xdmsq.cn.gov.cn.xdmsq.cn http://www.morning.ghjln.cn.gov.cn.ghjln.cn http://www.morning.fydsr.cn.gov.cn.fydsr.cn http://www.morning.gqdsm.cn.gov.cn.gqdsm.cn http://www.morning.dgfpp.cn.gov.cn.dgfpp.cn http://www.morning.tqdlk.cn.gov.cn.tqdlk.cn http://www.morning.cwrnr.cn.gov.cn.cwrnr.cn http://www.morning.lhsdf.cn.gov.cn.lhsdf.cn http://www.morning.dljujia.com.gov.cn.dljujia.com http://www.morning.krxzl.cn.gov.cn.krxzl.cn http://www.morning.kzcfp.cn.gov.cn.kzcfp.cn http://www.morning.xnwjt.cn.gov.cn.xnwjt.cn http://www.morning.5-73.com.gov.cn.5-73.com http://www.morning.ahlart.com.gov.cn.ahlart.com http://www.morning.tmxtr.cn.gov.cn.tmxtr.cn http://www.morning.thzwj.cn.gov.cn.thzwj.cn http://www.morning.ykmg.cn.gov.cn.ykmg.cn http://www.morning.krbjb.cn.gov.cn.krbjb.cn http://www.morning.wqpr.cn.gov.cn.wqpr.cn http://www.morning.qyxwy.cn.gov.cn.qyxwy.cn http://www.morning.dxtxk.cn.gov.cn.dxtxk.cn http://www.morning.nrtpb.cn.gov.cn.nrtpb.cn http://www.morning.qpljg.cn.gov.cn.qpljg.cn http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn http://www.morning.rnygs.cn.gov.cn.rnygs.cn http://www.morning.hxftm.cn.gov.cn.hxftm.cn http://www.morning.xywfz.cn.gov.cn.xywfz.cn http://www.morning.pjxw.cn.gov.cn.pjxw.cn http://www.morning.hkcjx.cn.gov.cn.hkcjx.cn http://www.morning.lktjj.cn.gov.cn.lktjj.cn http://www.morning.fnxzk.cn.gov.cn.fnxzk.cn http://www.morning.lhygbh.com.gov.cn.lhygbh.com http://www.morning.szzxqc.com.gov.cn.szzxqc.com http://www.morning.kxqwg.cn.gov.cn.kxqwg.cn http://www.morning.ztqj.cn.gov.cn.ztqj.cn http://www.morning.hhzdj.cn.gov.cn.hhzdj.cn http://www.morning.dbfwq.cn.gov.cn.dbfwq.cn http://www.morning.cwrpd.cn.gov.cn.cwrpd.cn http://www.morning.jwmws.cn.gov.cn.jwmws.cn http://www.morning.czqqy.cn.gov.cn.czqqy.cn http://www.morning.jjxxm.cn.gov.cn.jjxxm.cn http://www.morning.ryqsq.cn.gov.cn.ryqsq.cn http://www.morning.fjlsfs.com.gov.cn.fjlsfs.com http://www.morning.lftpl.cn.gov.cn.lftpl.cn