docker构建centos镜像

作者:吴业亮

博客:http://blog.csdn.net/wylfengyujiancheng

一、构建CentOS6镜像
1、下载 centos-6-docker.tar.xz 文件;

wget https://raw.githubusercontent.com/CentOS/sig-cloud-instance-images/da050e2fc6c28d8d72d8bf78c49537247b5ddf76/docker/centos-6-docker.tar.xz

2、创建 Dockerfile 文件 ( D 必须大写)

FROM scratch
MAINTAINER https://github.com/CentOS/sig-cloud-instance-images
ADD centos-6-docker.tar.xz /
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.name="CentOS Base Image" \
org.label-schema.vendor="CentOS" \
org.label-schema.license="GPLv2" \
org.label-schema.build-date="20190808"
RUN yum install openssh-server -y
EXPOSE 22
CMD ["/bin/bash"]

4、build 构建镜像

docker build -t centos6  .

二、构建CentOS7镜像

1、下载centos-7-docker.tar.xz

https://github.com/CentOS/sig-cloud-instance-images/tree/a77b36c6c55559b0db5bf9e74e61d32ea709a179/docker


wget https://raw.githubusercontent.com/CentOS/sig-cloud-instance-images/a77b36c6c55559b0db5bf9e74e61d32ea709a179/docker/centos-7-docker.tar.xz

2、centos 7 创建Dockerfile

FROM scratch
ADD centos-7-docker.tar.xz /
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.name="CentOS Base Image" \
org.label-schema.vendor="CentOS" \
org.label-schema.license="GPLv2" \
org.label-schema.build-date="20190808"
CMD ["/bin/bash"]

3、构建镜像

docker build -t centos7  .

你可能感兴趣的:(docker,centos,官方,docker)