云计算百科
云计算领域专业知识百科平台

国内服务器安装Docker提示Failed to connect to download.docker.com port 443的解决方案

解决方案

换国内镜像源。我用的是清华的。https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/

自己找自己对应的版本。

例如你的Ubuntu系统。就用下列命令

sudo curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc

echo \\
"deb [arch=$(dpkg –print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \\
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \\
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

其他系统例如 centos 就把上面命令里的 ubuntu 替换为 centos 即可。

其他操作跟官方文档一致。https://docs.docker.com/engine/install/ubuntu/

安装完成后HelloWorld跑不起来,需要配置最新可用的镜像源

⚠️⚠️⚠️ 自 2024-06-06 开始,国内的 Docker Hub 镜像加速器相继停止服务,可选择为 Docker daemon 配置代理或自建镜像加速服务。

参考链接🔗 Docker Hub 镜像加速器 | GitHub

sudo vim /etc/docker/daemon.json

向文件里添加如下内容。(2024年8月19号添加,如果发现没有用就去上面参考链接看看最新的)

{
"registry-mirrors": [
"https://x9r52uz5.mirror.aliyuncs.com",
"https://dockerhub.icu",
"https://docker.chenby.cn",
"https://docker.1panel.live",
"https://docker.awsl9527.cn",
"https://docker.anyhub.us.kg",
"https://dhub.kubesre.xyz"
]
}

保存后使用两个命令重启docker

sudo systemctl daemon-reload
sudo systemctl restart docker

然后使用命令

docker info

出现的结果中有刚刚配置的几个镜像源就代表成功了。

赞(0)
未经允许不得转载:网硕互联帮助中心 » 国内服务器安装Docker提示Failed to connect to download.docker.com port 443的解决方案
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!