国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。
配置加速地址
Ubuntu 16.04+、Debian 8+、CentOS 7+
创建或修改 /etc/docker/daemon.json
:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://dockerproxy.com",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.nju.edu.cn",
"https://docker.zhai.cm"
]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Docker Hub 镜像加速器列表
以下镜像站来源于互联网,可能出现宕机、转内网、关停等情况,建议同时配置多个镜像源。
镜像加速器 | 镜像加速器地址 | 专属加速器? | 其它加速? |
---|---|---|---|