用于Docker的auth URL的TLS自签名证书

时间:2017-01-10 01:03:10

标签: ssl go docker certificate openshift-origin

我正在尝试登录您使用oadm工具构建的Docker注册表。我尝试使用令牌登录:

# docker login -u $(oc whoami) -e 'xxxx' -p $(oc whoami -t) 172.30.10.52:5000
Error response from daemon: no successful auth challenge for   
https://172.30.10.52:5000/v2/ - errors: [basic auth attempt to 
https://172.30.10.52:5000/v2/ realm "openshift" failed with status: 400 Bad 
Request]

查看日志,我可以看到问题是因为我的实例使用了自签名证书:

time="2017-01-10T00:58:42.913539516Z" level=error msg="error authorizing context: 
Get https://ld7-zko8s6q-ws:8443/oapi/v1/users/~: x509: 
certificate signed by unknown authority" 
go.version=go1.4.2 http.request.host="172.30.10.52:5000" 
http.request.id=3fa81975-3aa9-44d8-a6a8-c00ad360009c 
http.request.method=GET http.request.remoteaddr="10.1.0.1:49316" 
http.request.uri="/v2/" http.request.useragent="docker/1.10.3 go/go1.6.2 
git-commit/429be27-unsupported kernel/3.10.0-514.2.2.el7.x86_64 
os/linux arch/amd64" instance.id=2a23b229-2a0e-4734-83c4-38cb9c8a0e00 

如何让我的证书受信任或关闭TLS验证?

1 个答案:

答案 0 :(得分:0)

您可以通过添加

测试 insecure registry
DOCKER_OPTS="--insecure-registry myregistrydomain.com:5000"

到您的/etc/default/docker文件或/etc/sysconfig/docker文件

但最好是add your self-signed certificate/etc/docker/certs.d/myregistrydomain.com:5000/ca.crt。并重新启动Docker守护程序 这样,它将信任您的证书。

请注意,Openshift起源有一个currently open issue 1753" Need机制,用于注册私人码头注册管理机构的证书" 另见" Can not pull image from remote node #6228"参考Openshift官方文档" Securing and Exposing the Registry"。