1、安装依赖

yum install -y yum-utils  device-mapper-persistent-data  lvm2 #安装依赖

2、添加yum源

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

3、安装containerd.io
4、如果报错

Error:
Problem: package docker-ce-3:19.03.6-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed

  • cannot install the best candidate for the job
  • package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
  • package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  • package containerd.io-1.2.2-3.el7.x86_64 is excluded
  • package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  • package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  • package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)

需要补安装

dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm #安装依赖
yum install docker-ce #再次安装

5、启动服务

systemctl enable docker
#创建服务
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
 systemctl start docker #启动服务
 systemctl status docker #服务状态

文章来源于互联网,如有雷同请联系站长删除:centos安装docker

发表评论