所以我试图运行我自己的码头注册表与身份验证,所以我可以访问它在外部。要做到这一点,我使用泊坞窗注册表映像从泊坞窗枢纽像这样:使用身份验证创建私有Docker注册表
docker run -p 5000:5000 -d -v /opt/registry:/tmp/registry registry:0.8.1
我然后使用HAProxy的这个链接的URL reg.mydomain.com
并添加认证:
userlist auth_list
group registry users root
user root password [password]
backend docker-registry
mode http
server localhost:5000_localhost localhost:5000 cookie localhost:5000_localhost
frontend web
mode http
bind *:80
bind *:443 ssl crt /path/to/ssl.pem
acl domain hdr(host) -i reg.mydomain.com
acl auth_docker_registry http_auth_group(auth_list) registry
acl registry_ping url_sub _ping
http-request auth realm Registry if !auth_docker_registry domain !registry_ping
use_backend docker-registry if domain
一旦我快在使用此命令登录:
[email protected]:~# docker login https://reg.mydomain.com
Username: root
Password:
Email:
Login Succeeded
问题是,当我运行一个命令来推或拉注册表我得到这些错误:
[email protected]:~# docker pull reg.mydomain.com/project1
The push refers to a repository [reg.mydomain.com/project1] (len: 1)
Sending image list
Pushing repository reg.mydomain.com/project1 (1 tags)
511136ea3c5a: Pushing
2014/11/24 20:40:33 HTTP code 401, Docker will not send auth headers over HTTP.
[email protected]:~# docker pull reg.mydomain.com/project1
Pulling repository reg.mydomain.com/project1
2014/11/24 20:40:38 Could not reach any registry endpoint
我在什么问题是,HTTPS连接在HAProxy的和连接的其余部分(HAProxy的和泊坞注册表容器之间)封端的猜测是HTTP但认证头仍然存在导致错误推动。为了测试这个,我将reqidel ^Authorization
添加到HAProxy配置的后端部分无济于事。
也值得注意的是,我可以在网页浏览器中浏览https://reg.mydomain.com
和子目录,例如/v1/_ping
,它可以按预期工作(我必须登录等)。此外,在撰写本文时,我使用的是码头注册表版本0.8.1
而不是0.9
,因为0.9
图像未启动。
如果有任何额外的信息需要,请让我知道。
感谢,JamesStewy