CentOS8.1安装docker记录


卸载 CentOS 8.1 自带的podman
[root@centos8 ~]# rpm -qa | grep -i podman
podman-manpages-1.6.4-4.module_el8.1.0+298+41f9343a.noarch
podman-1.6.4-4.module_el8.1.0+298+41f9343a.x86_64
[root@centos8 ~]# dnf remove podman podman-manpages



[root@centos8 ~]# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
[root@centos8 ~]# dnf repolist -v
docker-ce

默认软件源中的 containerd.io 版本较低,无法达到安装 docker-ce 的要求。

containerd.io > 1.2.0-3.el7

[root@centos8 ~]# wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.13-3.1.el7.x86_64.rpm
[root@centos8 ~]# dnf -y install containerd.io-1.2.13-3.1.el7.x86_64.rpm
[root@centos8 ~]#
[root@centos8 ~]# dnf list docker-ce
Last metadata expiration check: 0:47:00 ago on Wed 22 Apr 2020 04:01:41 PM CST.
Available Packages
docker-ce.x86_64    3:19.03.8-3.el7    docker-ce-stable
[root@centos8 ~]# dnf -y install docker-ce-3:19.03.8-3.el7


[root@centos8 ~]# systemctl start docker
[root@centos8 ~]# systemctl enable --now docker

[root@centos8 ~]# systemctl is-active docker
[root@centos8 ~]# systemctl is-enabled docker

[root@centos8 ~]# newgrp docker
[root@centos8 ~]# usermod -aG docker $USER

[root@centos8 ~]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:25:42 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
[root@centos8 ~]#

[root@centos8 ~]# vim /etc/docker/daemon.json
[root@centos8 ~]# cat /etc/docker/daemon.json
{
    "registry-mirrors" : [
    "https://registry.docker-cn.com",
    "https://docker.mirrors.ustc.edu.cn",
    "http://hub-mirror.c.163.com",
    "https://cr.console.aliyun.com/"
  ]
}

[root@centos8 ~]# systemctl restart docker

02-12 09:41