1.更新yum
yum update
2.安裝必要工具
yum install -y yum-utils device-mapper-persistent-data lvm2
3.添加軟件安裝源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新yum緩存
yum makecache fast
5.安裝docker-ce
yum -y install docker-ce
如果安裝報(bào)以下錯(cuò)誤泽台,則需要更新containerd
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
6.啟動(dòng) Docker 后臺(tái)服務(wù)
systemctl start docker
7.測(cè)試
docker run hello-world
8.設(shè)置開(kāi)機(jī)自啟
systemctl enable docker
cp /usr/lib/systemd/system/docker.service /etc/systemd/system/
systemctl daemon-reload
systemctl restart docker