Centos8.2轻松安装docker

系统 Centos8.2

Docker安装

  • step 1:安装一些必要的工具

    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  • step 2:添加软件源信息

    sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  • Step 3: 更新 Docker-CE

    sudo yum makecache fast
  • 错误: yum makecache: error: argument timer: invalid choice: ‘fast’ (choose from ‘timer’)
  • 问题: ‘索引的时候出错,即centos8没有该参数,解决办法为:去掉fast参数’
  • 命令改成: sudo yum makecache
  • 再次执行: sudo yum makecache
  • Step 4: 安装 Docker-CE

    sudo yum -y install docker-ce
  • 报错: Problem: package docker-ce-3:19.03.12-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed;
  • 根据提示,需要containerd.io的版本 >= 1.2.2-3,操作如下:
  • 安装wget指令 yum install wget;
  • 获取rpm包 wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm;
  • 升级containerd.io(安装rpm包) yum -y install containerd.io-1.2.6-3.3.el7.x86_64.rpm;
  • 再次执行 sudo yum -y install docker-ce;
  • Step 5: 开启Docker服务
    • 启动1: sudo service docker start
    • 启动2: sudo systemctl start docker
  • Step 6: 安装效验
    • docker version
    • sudo docker ps
  • 设置开机自启动
    sudo systemctl enable docker
  • 重启生效
    systemctl restart docker.service

你可能感兴趣的:(Docker,docker安装,centos8.2)