推广网站wap端怎么做,打开网站文件夹权限设置,网站建设问题新闻资讯,seo基础培训文章目录 前言1. 查找可用的镜像源2. 配置 Docker 镜像源3. 重启 Docker 服务4. 查看dock info是否修改成功5. 验证镜像源是否更换成功注意事项 前言
在pull镜像时遇到如下报错#xff1a;
┌──(root㉿kali)-[/home/longl]
└─# docker pull hello-world
Using default … 文章目录 前言1. 查找可用的镜像源2. 配置 Docker 镜像源3. 重启 Docker 服务4. 查看dock info是否修改成功5. 验证镜像源是否更换成功注意事项 前言
在pull镜像时遇到如下报错
┌──(root㉿kali)-[/home/longl]
└─# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
c1ec31eb5944: Retrying in 1 second
error pulling image configuration: download failed after attempts6: dial tcp 173.252.88.67:443: connect: connection refused解决方法换源
1. 查找可用的镜像源
首先你需要找到一个可用的镜像源。一些常见的国内镜像源包括
阿里云https://registry.cn-hangzhou.aliyuncs.com腾讯云https://mirrors.tencent.com/docker华为云https://mirror.ccs.tencent.com/dockerhub中国科技大学https://docker.mirrors.ustc.edu.cn/豆瓣(Douban)https://dockerhub.douban.com/
注意阿里云提供 [系统分配前缀].mirror.aliyuncs.com 具体上阿里云容器HUB控制台查看(需要账号) 阿里云容器HUB控制台 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors 2. 配置 Docker 镜像源
Docker 可以通过修改配置文件来更换镜像源。你可以使用 Docker 提供的 daemon.json 文件来配置镜像源。 打开或创建 daemon.json 文件。这个文件通常位于 /etc/docker/ 目录下 如果没有创建daemon.json文件就自己创建一下 sudo touch /etc/docker/daemon.json编辑daemon.json sudo vim /etc/docker/daemon.json在 daemon.json 文件中添加以下内容将 MIRRORS 替换为你选择的镜像源 {registry-mirrors: [https://MIRRORS.mirror.com]
}例如如果你想使用中科大的镜像源你应该这样写 {registry-mirrors: [https://docker.mirrors.ustc.edu.cn/]
}建议使用阿里的镜像加速器提供的源 保存并关闭文件。
3. 重启 Docker 服务
配置完成后需要重启 Docker 服务以使配置生效
sudo systemctl restart docker4. 查看dock info是否修改成功
如果修改成功可以在info中查看到修改后的源
sudo docker info5. 验证镜像源是否更换成功
为了验证是否成功更换了镜像源你可以尝试拉取一个镜像比如 hello-world
docker pull hello-world如果镜像成功下载并且过程中没有出现之前的错误那么更换镜像源就成功了。
成功
┌──(root㉿kali)-[/etc/docker]
└─# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest┌──(root㉿kali)-[/etc/docker]
└─# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 2 years ago 13.3kB注意事项
确保你使用的镜像源支持你想要拉取的镜像。有些镜像源可能需要认证这种情况下你需要在 Docker 的配置中添加认证信息。如果你在使用 Docker Compose你可能还需要配置 .env 文件或 Docker Compose 的配置文件来指定镜像源。
更换镜像源是一个常见的操作特别是在网络条件不佳或者需要访问特定地区镜像源的情况下。通过上述步骤你应该能够顺利地更换 Docker 的镜像源。