[root@localhost ~]# yum search docker
Docker CE Stable - x86_64 240 B/s | 394 B 00:01
Errors during downloading metadata for repository 'docker-ce-stable':
- Status code: 404 for https://download.docker.com/linux/centos/20.03LTS_SP3/x86_64/stable/repodata/repomd.xml (IP: 13.224.160.26)
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
- cannot install the best candidate for the job
- nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64
- nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64
解决:
添加centos-base库,同样替换成centos-8的版本。
123
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo
[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
:%s/$releasever/8/g
# https://docker.mirrors.ustc.edu.cn/
# https://hub-mirror.c.163.com
# https://reg-mirror.qiniu.com
[root@localhost ~]# cat /etc/docker/daemon.json
{
"registry-mirrors":["https://reg-mirror.qiniu.com/"]
}
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost ~]# docker info
Registry Mirrors:
https://reg-mirror.qiniu.com/
运行一个hello-world看看速度:
123456789101112131415161718192021222324252627
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:975f4b14f326b05db86e16de00144f9c12257553bba9484fed41f9b6f2257800
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/