当前用到的环境是:
Centos 7.5
docker-ce 18.06.1-ce
1、先用centos7.5.1804的基础镜像把一些运行需要的环境装好
在/app目录下创建相对应的文件目录
[root@node2 /app/]# mkdir dockerfile/{web/{nginx,tomcat,jdk,apache},system/{centos,ubuntu,redhat}} -pv
[root@node2 /app]# cd dockerfile/system/centos/
[root@node2 /app/dockerfile/system/centos]# mkdir centos-7.5-base
[root@node2 /app/dockerfile/system/centos]# cd centos-7.5-base
创建一个Dockerfile文件
[root@node2 /app/dockerfile/system/centos/centos-7.5-base]#vim Dockerfile
#Nginx Base Image
FROM centos:7.5.1804
LABEL maintaier "mr.luo "
RUN yum install -y vim wget pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop
创建一个用于直接docker build脚本后续直接执行脚本即可
[root@node2 /app/dockerfile/system/centos/centos-7.5-base]#vim build-command.sh
#!/bin/bash
docker build -t 172.20.7.50/baseimages/centos-base:7.5.1804 .
执行脚本创建新镜像
[root@node2 /app/dockerfile/system/centos/centos-7.5-base]#bash build-command.sh
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM centos:7.5.1804
---> 76d6bc25b8a5
Step 2/3 : LABEL maintaier 'mr.luo@dklwj.com'
---> Using cache
---> 05ccd970d71d
Step 3/3 : RUN yum install -y vim wget pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop
---> Using cache
---> 73d683a54877
Successfully built 73d683a54877
Successfully tagged 172.20.7.50/baseimages/centos-base:7.5.1804
2、利用制作好的基础环境镜像制作jdk的镜像