Featured image of post Docker Hub 加速镜像

Docker Hub 加速镜像

使用镜像是每个中国程序员不得不学会的技巧

1. 配置镜像地址

不推荐阿里云的,因为阿里云的镜像不是实时同步的,有时候会出现 latest tag 与官方源的 latest 差了几个月的情况。其他的镜像源可以在资料参考中找到。

直接执行下面的命令即可。

1
2
3
4
5
6
7
8
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "registry-mirrors": [
        "https://docker.m.daocloud.io",
        "https://dockerproxy.com"
    ]
}
EOF

2. 刷新配置

1
sudo systemctl daemon-reload

3. 刷新配置

重启 Docker

1
sudo systemctl restart docker

参考资料

国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践

Built with Hugo
主题 StackJimmy 设计