解决方案:
[root@a ~]# yum install -y wget
[root@a ~]# wget -O http://mirrors.aliyun.com/repo/Centos-7.repo
[root@a ~]# mv Centos-7.repo /etc/yum.repos.d/
[root@a ~]# yum install epel-release
[root@a ~]# yum install container-selinux
2、安装最新版本的 Docker Engine-Community 和 containerd
[root@a ~]# yum install docker-ce docker-ce-cli containerd.io
…
Installed:
containerd.io.x86_64 0:1.2.13-3.2.el7 docker-ce.x86_64 3:19.03.8-3.el7
docker-ce-cli.x86_64 1:19.03.8-3.el7
Complete!
[root@a ~]# systemctl start docker
[root@a ~]# docker --version
Docker version 19.03.8, build afacb8b
登录阿里云搜素镜像加速器
[root@a ~]# mkdir -p /etc/docker
[root@a ~]# tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [“https://…”]
}
EOF
[root@a ~]# systemctl daemon-reload
[root@a ~]# systemctl restart docker
[root@a ~]# ps -ef |grep docker
root 12225 1 0 08:10 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 12362 1737 0 08:12 pts/0 00:00:00 grep --color=auto docker
[root@a ~]# docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1<