简体   繁体   English

docker(代理后面)从azure容器注册表工作拉,但是从registry-1.docker.io,它提供由未知权限错误签名的证书

[英]docker (behind a proxy) pull from azure container registry works but from registry-1.docker.io, it gives certificate signed by unknown authority error

In ubuntu 18.04 VM 在ubuntu 18.04 VM中

I am behind a proxy, I've set up docker configuration with the same proxy. 我在代理后面,我已经使用相同的代理设置了docker配置。

I created an azure container registry and when trying to docker pull from the registry it works. 我创建了一个azure容器注册表,当尝试从注册表中停靠时,它可以工作。

But when trying to: 但是当试图:

$docker run node:6 $ docker run node:6

I get the error: "docker: Error response from daemon: Get https://registry-1.docker.io/v2/ : x509: certificate signed by unknown authority." 我收到错误:“docker:来自守护程序的错误响应:获取https://registry-1.docker.io/v2/:x509 :由未知权限签署的证书。”

I've added the registry to /etc/docker/daemon.json: 我已将注册表添加到/etc/docker/daemon.json:

{ {

"insecure-registries": ["registry-1.docker.io","myazureContainerRegistry.azurecr.io"] “insecure-registries”:[“registry-1.docker.io”,“myazureContainerRegistry.azurecr.io”]

} }

By doing the above step, "$docker run myazureContainerRegistry.azurecr.io/myimage:tag" works but "$docker run node:6" still gives the certificate error. 通过执行上述步骤,“$ docker run myazureContainerRegistry.azurecr.io/myimage:tag”可以正常工作,但“$ docker run node:6”仍然会出现证书错误。

I've added the certificate for "*.docker.io" to /etc/docker/certs.d/docker.io and also to /usr/local/share/ca-certificate (sudo apt update-ca-certificates), still it doesn't work. 我已将“* .docker.io”的证书添加到/etc/docker/certs.d/docker.io以及/ usr / local / share / ca-certificate(sudo apt update-ca-certificates),它还行不通。

I've also tried to: 我也尝试过:

  1. $curl -k https://registry-1.docker.io/ $ curl -k https://registry-1.docker.io/

  2. $wget https://registry-1.docker.io/ --no-check-certificate $ wget https://registry-1.docker.io/ --no-check-certificate

Both of these steps work but with docker (to run/pull node:6 ) I still get the certificate error. 这两个步骤都有效,但是使用docker(运行/拉出节点:6)我仍然得到证书错误。

The output of "$docker --version" is: "Docker version 18.09.2" “$ docker --version”的输出是:“Docker版本18.09.2”

This is how my ~/.docker/config.json looks like: 这就是我的〜/ .docker / config.json的样子:

config.json config.json

I expect "docker run node:6" to pull the image successfully but it actually gives the error 我希望“docker run node:6”能够成功拉出图像,但实际上却给出了错误

For your issue, first of all, you need to have the certificate in the ~/.docker/config.json. 对于您的问题,首先,您需要在〜/ .docker / config.json中拥有证书。 Then you can pull the image from the registry without login. 然后,您无需登录即可从注册表中提取图像。 Then you can execute the command without pulling the image before. 然后您可以在不拉动图像的情况下执行命令。 for you, the command like this: 为你,这样的命令:

docker run registry-1.docker.io/node:6

In my side, the config.json will like this: 在我这边,config.json会喜欢这样:

在此输入图像描述

And I can execute the command like this: 我可以像这样执行命令:

在此输入图像描述

The URI of registry in the docker hub is https://index.docker.io/v1/charlesjunqiang . docker hub中的注册表URI是https://index.docker.io/v1/charlesjunqiang

Update 更新

If you use the certificate file to authenticate the Docker registry. 如果您使用证书文件来验证Docker注册表。 Then you should do some steps to authenticate the Docker registry in the client machine. 然后,您应该执行一些步骤来验证客户端计算机中的Docker注册表。

One: 一:

Add the certificate file in the directory /usr/local/share/ca-certificates/docker-dev-cert/ with the name yourname.crt . 将证书文件添加到目录/usr/local/share/ca-certificates/docker-dev-cert/ ,名称为yourname.crt Then execute the commands: 然后执行命令:

sudo update-ca-certificates
sudo service docker restart

Secord: Secord:

Create a directory in the directory /etc/docker/certs.d with the same name as the registry, for example, myregistry.azurecr.io. 在目录/etc/docker/certs.d创建一个与注册表同名的目录,例如myregistry.azurecr.io。 Then add the certificate file in it with the name yourname.cert . 然后在其中添加名称为yourname.cert的证书文件。 Also, you should add the file as .key that automatic created when you create the certificate file. 此外,您应该将文件添加为在创建证书文件时自动创建的.key。

Then you can log in the registry and run the command docker run registry-1.docker.io/node:6 as you want. 然后,您可以登录注册表并根据需要运行命令docker run registry-1.docker.io/node:6

There are screenshots of the result in my side. 在我这边有结果的截图。

在此输入图像描述 在此输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自守护进程的 docker 工具箱错误响应:获取 https://registry-1.docker.io/v2/: x509: 证书由未知机构签名 - docker toolbox Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certific ate signed by unknown authority 尝试从受信任的注册表中提取Docker映像时出现“由未知机构签名的证书” - “certificate signed by unknown authority” while trying to pull docker image from trusted registry 适用于Windows 7的Docker-获取https://registry-1.docker.io/v1/repositories/library/hello-world/tags/latest:x509:未知授权机构签署的证书 - Docker for windows 7- Get https://registry-1.docker.io/v1/repositories/library/hello-world/tags/latest: x509: certificate signed by unknown authority 来自守护进程的错误响应:获取 https://registry-1.docker.io/v2/:需要代理身份验证 - Error response from daemon: Get https://registry-1.docker.io/v2/: Proxy Authentication Required docker 提示: 来自守护进程的错误响应:Get https://registry-1.docker.io/v2/: x509: certificate is valid for - docker hint: Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate is valid for Docker注册表登录失败,并显示“由未知权限签名的证书” - Docker registry login fails with “Certificate signed by unknown authority” Docker 私有注册表:x509:由未知权威签名的证书 - Docker Private Registry: x509: certificate signed by unknown authority 无法提取映像“ levm38 / server:latest”:rpc错误:代码=未知desc =来自守护程序的错误响应:获取https://registry-1.docker.io/v2/:EOF - Failed to pull image “levm38/server:latest”: rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: EOF 为什么我得到 x509:由 Azure DevOps 上的未知权威签名的证书 docker push to registry - Why am I getting x509: certificate signed by unknown authority on Azure DevOps docker push to registry 从“registry-1.docker.io”获取容器时,Docker build 会引发“Bad Gateway”错误 - Docker build throws 'Bad Gateway' error when getting the contatiner from "registry-1.docker.io"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM