docker仓库无法访问

方式一:临时生效

官方镜像路径前面加域名

原命令:docker pull hello-world:latest

命令前添加镜像地址 docker pull hub.rat.dev/hello-world:latest

方式二:永久生效

修改文件 /etc/docker/daemon.json(如果不存在则需要手动创建)

加速地址(2025年2月16日 15点42分)

{
    "registry-mirrors": [
        "https://hub.rat.dev",
        "https://docker.1ms.run",
        "https://docker.hlmirror.com",
        "https://docker.imgdb.de",
        "https://docker.1panel.live",
        "https://hub.1panel.dev",
        "https://docker.melikeme.cn",
        "https://doublezonline.cloud",
        "https://image.cloudlayer.icu",
        "https://docker.actima.top",
        "https://lispy.org",
        "https://docker.xiaogenban1993.com",
        "https://docker-0.unsee.tech",
        "https://docker.xuanyuan.me",
        # "https://docker.aityp.com",
        # "https://docker.m.daocloud.io",
        # "https://docker.1panelproxy.com",
        # "https://proxy.1panel.live",
        # "https://docker.1panel.top",
        # "https://docker.wanpeng.top",
        # "https://docker.zhai.cm",
        # "https://docker.anye.in"
        # "https://a.ussh.net",
        # "https://dislabaiot.xyz",
        # "https://dockerpull.cn",
        # "https://func.ink",
        # "https://hub.geekery.cn",
        # "https://docker.rainbond.cc",
    ]
}

https://xdark.top/ 需要赞助获取账户密码

https://www.sunzishaokao.com/registry 需要关注B站账户获取账户密码

  • 重新加载守护进程daemon的配置
systemctl daemon-reload
  • 重启 Docker 服务
systemctl restart docker
  • 使用docker info查看配置的镜像地址是否生效
....
 Registry Mirrors:
  https://hub.rat.dev/
 Live Restore Enabled: false
  • 运行helloworld验证是否正常工作
sudo docker run hello-world

这个命令会下载一个测试镜像并在容器中运行它。如果一切正常,你会看到一条欢迎信息,表明Docker已经成功安装并可以正常工作。

  • 绝大多数的加速镜像 是不支持search的,会报错

阿里镜像加速-获取加速器地址

访问产品手册:https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images#section-9tt-j3m-d2f

image-20240129220942994

点击容器进项服务控制台,然后在容器镜像服务页面的左侧导航栏选择镜像工具 > 镜像加速器,在镜像加速器页面获取加速器地址

image-20240201201349628

每个人的加速器地址不同,使用自己的应该会快一些。

在加速地址下方还有不同操作系统的配置方式。

windows下Docker配置镜像地址

方法1:打开Docker for Windows设置,选择Docker Engine,在右侧的文本框中,填入镜像地址,点击右下角保存配置。

image-20240201201508495

方法2:直接修改daemon.json。文件地址:"C:\Users\zbf.docker\daemon.json"

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "registry-mirrors":["https://**ID**.mirror.aliyuncs.com"]
}

使用命令测试配置是否成功。

image-20240129231055768

加速地址来源于:

docker #不能访问

posted @ 2024-01-29 23:23  姬雨晨  阅读(1182)  评论(0)    收藏  举报