简体   繁体   English

Docker私有注册表-推送到“不安全的注册表”仍然抱怨“未知权限”

[英]Docker Private Registry - push to 'insecure-registry' still complains about 'unknown authority'

I have a remote Docker registry setup. 我有一个远程Docker注册表设置。 It has a go-daddy SSL cert installed. 它安装了Godaddy SSL证书。

If I curl it I get an 'unknown authority' error: 如果我卷曲它,则会收到“未知权限”错误:

curl https://example.com:5000/v2/

curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none 
More details here: http://curl.haxx.se/docs/sslcerts.html

...

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.

So I then use the 'insecure' curl: 因此,我然后使用“不安全的”卷曲:

curl -k https://example.com:5000/v2

and I get 我得到

{} //which I guess is because there is nothing in the registry?

to check, I curl a non-existent endpoint: 要检查,我卷曲了一个不存在的端点:

curl -k https://example.com:5000/moo

404 page not found //which is positive, as it means the -k flag is suppressing the 'unknown authority' correctly

So, now I know that it is possible to connect to the registry by curl I try using Docker client to push an image: 因此,现在我知道可以尝试通过Docker客户端推送映像来通过curl连接到注册表了:

docker push example.com:5000/my-image

The push refers to a repository [example.com:5000/my-image] 
unable to ping registry endpoint https://example.com:5000/v0/
v2 ping attempt failed with error: Get https://example.com:5000/v2/: x509: certificate signed by unknown authority
v1 ping attempt failed with error: Get https://example.com:5000/v1/_ping: x509: certificate signed by unknown authority

So I then try to suppress the error by adding 'insecure-registry' to DOCKER_OPTS (as explained here ): 所以,我再尝试加入“不安全的注册表”来DOCKER_OPTS(如解释取消错误这里 ):

DOCKER_OPTS="--insecure-registry example.com:5000" DOCKER_OPTS =“-不安全的注册example.com:5000”

[restart docker daemon] [重启docker守护进程]

And it does not work. 而且它不起作用。 I get the same 'unknown authority' warning. 我收到相同的“未知权限”警告。

Firstly, why is a certificate from Go Daddy not trusted? 首先,为什么不信任Go Daddy颁发的证书? I have it setup on an nginx server and it is working fine with the 'green bar' on the browser. 我在nginx服务器上安装了它,并且在浏览器上的“绿色条”上工作正常。

Secondly, how can I get the 'insecure-registry' to work with Docker? 其次,如何使“不安全注册表”与Docker一起使用? Thanks 谢谢

Ok, I got to the bottom of this. 好吧,我已经深入到这一点。

Turns out I didn't need to modify /etc/default/docker with this: 原来我不需要用以下命令修改/ etc / default / docker:

DOCKER_OPTS="--insecure-registry example.com:5000"

The issue was that the Go-Daddy certificate I installed in the registry needed to have the intermediate certificates too. 问题是我在注册表中安装的Go-Daddy证书也需要具有中间证书。 I received the following from Go-Daddy: 我从Go-Daddy收到以下信息:

domain.crt
some-bundle.crt

You need to 你需要

cat bundle.crt >> domain.crt

so that the certificate chain is complete. 这样证书链就完整了。 Then it all works fine 然后一切正常

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM