larrow / shelter

A private container registry server based on Docker Distribution
63 stars 14 forks source link

关于https的配置 #45

Closed linsheng9731 closed 7 years ago

linsheng9731 commented 7 years ago

我大概看了一下配置,在 config/nginx/下有个nginx.https.conf,把它重名成nginx.conf,然后修改里面的配置,把证书指向自己私有的,是不是就可以了?

29 # SSL 30 ssl_certificate /etc/nginx/cert/yourdomain.com.crt; 31 ssl_certificate_key /etc/nginx/cert/yourdomain.com.key;

qinix commented 7 years ago

是的,nginx.confnginx.https.conf 分别对应 http 和 https 的配置

linsheng9731 commented 7 years ago

在https协议下,分别用了mac和linux测试登陆,均失败。

docker login -u admin -p shelter12345 shelter.xxx.com

mac 报:

Error response from daemon: Get https://shelter.xxx.com/v2/: unauthorized: authentication required

mac 上的docker版本:

Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      linux/amd64
 Experimental: true

linux 报

Error response from daemon: Get https://shelter.xxx.com/v1/users/: dial tcp: lookup shelter.xxx.com on 10.0.1.237:53: read udp 10.0.1.237:45046->10.0.1.237:53: i/o timeout

linux上docker版本

Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.3
 Git commit:   b9f10c9/1.11.2
 Built:
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.3
 Git commit:   b9f10c9/1.11.2
 Built:
 OS/Arch:      linux/amd64
qinix commented 7 years ago

当程序询问 What's your server host: 时输入的是什么?

linsheng9731 commented 7 years ago

我是从源码的docker-compose.yml 启动的,自己在nginx的配置里把服务器地址改成 shelter.xxxx.com

qinix commented 7 years ago

这个地址需要正确的指定,要求客户端能够正确的访问到,因为这个地址是会返回给 docker 客户端,客户端用这个地址向服务器发起认证

linsheng9731 commented 7 years ago

在哪里配置?

qinix commented 7 years ago

config/registry/config.yml

auth:
  token:
    issuer: registry-token-issuer
    realm: http://localhost/service/token

这里把 localhost 改成客户端可以访问的地址

linsheng9731 commented 7 years ago

好的,谢谢,有空能补补文档么?我觉得这个项目做的挺好的,就是文档少了点。

qinix commented 7 years ago

感谢建议!