报错如下:

root@VM-8-7-debian:~# apt update
Hit:1 http://mirrors.tencentyun.com/debian bookworm InRelease
Get:2 http://mirrors.tencentyun.com/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://mirrors.tencentyun.com/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://mirrors.tencentyun.com/debian-security bookworm-security/main amd64 Packages [169 kB]
Get:5 http://mirrors.tencentyun.com/debian-security bookworm-security/main Translation-en [102 kB]                      
Ign:6 https://download.docker.com/linux/debian bookworm InRelease                                                                                                                                                                                                                                                                            
Ign:6 https://download.docker.com/linux/debian bookworm InRelease          
Ign:6 https://download.docker.com/linux/debian bookworm InRelease
Err:6 https://download.docker.com/linux/debian bookworm InRelease
  Cannot initiate the connection to download.docker.com:443 (2a03:2880:f12c:83:face:b00c:0:25de). - connect (101: Network is unreachable) Could not connect to download.docker.com:443 (67.15.129.210), connection timed out
Fetched 374 kB in 37s (10.0 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
82 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch https://download.docker.com/linux/debian/dists/bookworm/InRelease  Cannot initiate the connection to download.docker.com:443 (2a03:2880:f12c:83:face:b00c:0:25de). - connect (101: Network is unreachable) Could not connect to download.docker.com:443 (67.15.129.210), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

修复方法(腾讯云)

  • 这里用的是腾讯云的镜像
打开/etc/apt/sources.list.d/docker.list

原文如下:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian   bookworm stable

修改为如下内容

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.cloud.tencent.com/docker-ce/linux/debian   bookworm stable

修复解释

腾讯的镜像页面docker-ce (tencent.com),可以看到这是CentOS系统的修改指南:

1722633002100.png

关键是第二句的这一部分

sudo sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+'

后面的路径没有用,因为Debian的和CentOS的不同。

前面这段的意思是把download.docker.com变为mirrors.cloud.tencent.com/docker-ce,所以我们按照这个改就行。

最后修改:2024 年 08 月 03 日
如果觉得我的文章对你有用,请随意赞赏