文章内容

2025/12/19 18:21:54,作 者: 黄兵

Could not handshake: Error in the pull function

最近在 Ubuntu 20.04.6 LTS 上安装 Docker 的时候出现了:

E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/containerd.io_1.7.27-1_amd64.deb Could not handshake: Error in the pull function. [IP: 2600:9000:26a6:dc00:3:db06:4200:93a1 443]

E: Failed to fetch https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-buildx-plugin_0.23.0-1~ubuntu.20.04~focal_amd64.deb Could not handshake: Error in the pull function. [IP: 2600:9000:26a6:dc00:3:db06:4200:93a1 443]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

出现问题的原因:

在国内 / 部分海外 VPS 上非常常见且明确的原因

APT 在通过 IPv6 访问 Docker 官方源时,TLS 握手失败

上面的 IP 地址:

IP: 2600:9000:26a6:dc00:3:db06:4200:93a1 443

这是 IPv6 地址(CloudFront / AWS CDN),而不是 Docker 本身的问题。

解决方案:

禁用 APT 的 IPv6

这是 90% 情况下立刻生效 的方法。

1️⃣ 创建 APT IPv4-only 配置
sudo nano /etc/apt/apt.conf.d/99force-ipv4

写入以下内容:

Acquire::ForceIPv4 "true";

保存退出。

2️⃣ 重新更新并安装 Docker
sudo apt clean
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

绝大多数情况下,到这里就能成功。


其它相关推荐:

1、Ubuntu 24.04 如何安装 Docker

2、docker run -d 这里的 -d 参数具体作用?

3、查看所有 docker 容器占用内存

4、Ubuntu 24.04 安装 Docker Compose v2

5、Docker 容器开机自动启动

分享到:

发表评论

评论列表