如何在 Ubuntu 18.04 上安装 Docker 时出现 https 代理错误

如何在 Ubuntu 18.04 上安装 Docker 时出现 https 代理错误

我遇到安装问题DockerUbuntu 18.04

当我尝试以下几行时,我收到 https 错误,因为没有 http 版本,而且我们落后于一家公司代理人所以它失败了。

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

sudo apt update

失败。

Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification.

是否有其他方法可以使用 curl 或 wget 来安装某个版本?

有没有办法绕过 apt conf 中的代理来告诉它忽略证书错误?

编辑我尝试使用 [trusted=yes] 标志,但是我认为这不起作用,因为这会恢复为 http 并且没有 http URL。

Err:6 https://download.docker.com/linux/ubuntu bionic Release                                        
Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification.
E: The repository 'https://download.docker.com/linux/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

答案1

docker 的站点以下是安装docker的步骤:

更新 apt 软件包索引

sudo apt-get update

安装 Docker 所需的软件

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

添加 Docker 的 GPG 密钥

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

注意:您应该检查密钥是否正确。(点击链接)

添加 Docker 的存储库

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

然后使用 apt 更新

sudo apt-get update

现在你可以使用 apt 安装 docker

sudo apt-get install docker-ce docker-ce-cli containerd.io

相关内容