由于 docker repo,无法运行 apt-get update 命令!

由于 docker repo,无法运行 apt-get update 命令!

几个月前,我在 ubuntu 系统中安装了 docker。当时它运行正常。但是今天我在运行apt-get update命令时看到了这个错误。

Failed to fetch https://download.docker.com/linux/ubuntu/dists/trusty/stable/binary-amd64/Packages  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/trusty/edge/binary-amd64/Packages  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

E: Some index files failed to download. They have been ignored, or old ones used instead

docker pull 命令未运行。我使用以下命令卸载了 docker。

sudo apt-get remove docker docker-engine docker-ce docker.io

但仍然面临同样的问题。

也尝试过跑

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

根据docker教程。但是出现以下错误:

curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
gpg: no valid OpenPGP data found.

答案1

问题在于存储库位于 /etc/apt/sources.list.d 文件夹中或直接位于 /etc/apt/sources.list 文件中。一旦您将其从那里删除,您就可以开始了。

不过,我建议修复丢失的 GPG 密钥,如 https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository 正如用户 Rovo 所建议的

相关内容