root yum install -y yum-utils

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

root yum install docker-ce docker-ce-cli containerd.io

systemctl start docker

systemctl enable docker

ls /var/lib/docker/

vi Dockerfile

FROM centos:7.8.2003

MAINTAINER xxx@163.com

RUN yum install -y wget epel-release && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/Centos-7.repo && wget -P /etc/yum.repos.d/ http://mirrors.163.com/.help/CentOS7-Base-163.repo && yum clean all && yum makecache && yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel ntpdata crontabs

RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

docker build -t centos7.8:v1 /root/

[root@docker1 ~]# docker images

REPOSITORY   TAG        IMAGE ID       CREATED          SIZE

centos7.8    v1         e83e208bf28d   26 seconds ago   873MB

centos       7.8.2003   afb6fca791e0   23 months ago    203MB