安裝一些必要的系統工具:

yum install -y yum-utils device-mapper-persistent-data lvm2

  添加軟件源信息:

 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

  更新 yum 緩存:

yum makecache fast

安裝 Docker-ce:

yum -y install docker-ce
啟動 Docker 后臺服務:
systemctl start docker
測試運行 hello-world:
docker run hello-world  出現如下報錯

配置網卡

vim /etc/sysconfig/network-scripts/ifcfg-ens32 

加入如下兩行:

DNS1=8.8.8.8
DNS2=114.114.114.114

重啟網卡

systemctl restart docker

繼續測試hello-world

vim  /etc/sysctl.conf  

加入:net.ipv4.ip_forward=1

搭建完成