51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

docker mirrors (适合中国宝宝的镜像源)

Docker Mirror

从去年开始. hub.docker.com^[1]^ 在国内的访问速度极慢. 当时大家主要还是依赖国内的一些镜像源: 如中科院或alipapa etc. 但是今年逐渐所有的国内镜像站也逐渐关闭. 在墙内的小伙伴想要拉取镜像变成了很困难的事情。

现在可以使用 docker-mirror^[2]^ 来加速你的镜像服务. 仅需根据你的使用情况简单几步配置即可完成配置. 此外还提供两个搜索网站来帮助检索镜像.

  • docker-mirror^[3]^

  • hub.dockermirror^[4]^

视频教程

注: 视频中使用的是 orb. 基本操作和直接使用 docker 相同. 具体细节可以查看下面的配置方法.

配置方法

使用 Docker File

编辑 /etc/docker/daemon.json,并添加 registry-mirror^[5]^ 键和值,使更改始终生效。

{
  "registry-mirrors": ["https://registry.dockermirror.com"]
}

更多细节, 见 docker 文档^[6]^.

如果你正在使用 orbstack. 你也可以直接在 ~/.orbstack/config/docker.json 中编辑配置,然后用 orb restart docker 重启引擎。

{
  "hosts": ["https://registry.dockermirror.com"]
}

更多 orb 细节, 见 orb 文档^[7]^.

命令行使用配置

在手动拉取 dockerd 镜像时,通过 --registry-mirror 选项来使更改 registry。

$ docker pull ubuntu --registry-mirror=https://registry.dockermirror.com

更多细节, 见 docker pull 文档^[8]^.

直接使用 Registry

手动指定要从注册表中提取的路径。注册表路径类似于 URL,但不包含协议指定符 (https://)。

$ docker pull registry.dockermirror.com/ubuntu

更多细节, 见 docker pull-from-a-different-registry 文档^[9]^.

相关链接

  • github^[10]^

  • website-github^[11]^

  • website^[12]^

  • hub.dockermirror^[13]^

参考资料 [1]

hub.docker.com: https://hub.docker.com/[2]

docker-mirror: https://dockermirror.com[3]

docker-mirror: https://dockermirror.com[4]

hub.dockermirror: https://hub.dockermirror.com/[5]

registry-mirror: https://docs.docker.com/docker-hub/mirror/#configure-the-docker-daemon[6]

docker 文档: https://docs.docker.com/docker-hub/mirror/#configure-the-docker-daemon[7]

orb 文档: https://docs.orbstack.dev/docker/#engine-config[8]

docker pull 文档: https://docs.docker.com/reference/cli/docker/image/pull/?highlight=docker&highlight=pull[9]

docker pull-from-a-different-registry 文档: https://docs.docker.com/reference/cli/docker/image/pull/?highlight=docker&highlight=pull#pull-from-a-different-registry[10]

github: https://github.com/docker-mirrors[11]

website-github: https://github.com/docker-mirrors/website[12]

website: https://dockermirror.com[13]

hub.dockermirror: https://hub.dockermirror.com


赞(3)
未经允许不得转载:工具盒子 » docker mirrors (适合中国宝宝的镜像源)