1.安装JDK
yum install java-11-openjdk.x86_64
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
如果安装报以下错误,则需要更新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.启动 Docker 后台服务
systemctl start docker
7.测试
docker run hello-world
8.设置开机自启
systemctl enable docker
cp /usr/lib/systemd/system/docker.service /etc/systemd/system/
systemctl daemon-reload
systemctl restart docker
网友评论