2016-07-06 5 views
1

Я пытаюсь нажать изображение к моему Docker частного хранилища:Docker: частный доступ к реестру

docker pull busybox 
docker tag busybox living-registry.com:5000/busybox 
docker push living-registry.com:5000/busybox 

Docker говорит мне:

The push refers to a repository [living-registry.com:5000/busybox] Get https://living-registry.com:5000/v1/_ping : read tcp 195.83.122.16:39714->195.83.122.16:5000: read: connection reset by peer

Эти команды выполняются на CoreOS.

В другой машине, я начал свой реестр с помощью этой команды:

docker run -d -p 5000:5000 --restart=always --name registry \ 
    -v /root/docker-registry/auth:/auth \ 
    -e "REGISTRY_AUTH=htpasswd" \ 
    -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \ 
    -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \ 
    -v /root/docker-registry/certs:/certs \ 
    -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \ 
    -e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \ 
    -v /root/docker-registry/data:/var/lib/registry \ 
    registry:2 

Все, кажется, правы:

# netstat -tupln | grep 5000 
tcp6  0  0 :::5000  :::*  LISTEN  3160/docker-proxy 

# docker ps 
CONTAINER ID  IMAGE    COMMAND     CREATED    STATUS       PORTS     NAMES 
27e79f6a504c  registry:2   "/bin/registry serve " About an hour ago Restarting (2) 36 minutes ago 0.0.0.0:5000->5000/tcp registry 

Так что, когда я пытаюсь войти в систему:

[[email protected] certs]# docker login living-registry.com:5000 
Username: xxxx 
Password: xxxx 

Error response from daemon: Get https://living-registry.com:5000/v1/users/ : read tcp 195.83.122.16:39756->195.83.122.16:5000: read: connection reset by peer

Любые идеи?

EDIT

Я уже добавил сертификат (ca.crt) в /etc/ssl/certs и в /etc/docker/certs.d/x.x.x.x:5000/.

Из этого экземпляра CoreOS, я пытаюсь выполнить это:

$ docker login https://x.x.x.x:5000 Username: xxx Password: Email: [email protected] И он говорит мне:

Error response from daemon: invalid registry endpoint https://x.x.x.x:5000/v0/ : unable to ping registry endpoint https://x.x.x.x:5000/v0/ v2 ping attempt failed with error: Get https://x.x.x.x:5000/v2/ : EOF v1 ping attempt failed with error: Get https://x.x.x.x:5000/v1/_ping : EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add --insecure-registry x.x.x.x:5000 to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/x.x.x.x:5000/ca.crt

Я также пытался получить соединение непосредственно с openssl:

openssl s_client -connect x.x.x.x:5000 

выход:

CONNECTED(00000003) 
140180300502672:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177: 
--- 
no peer certificate available 
--- 
No client certificate CA names sent 
--- 
SSL handshake has read 0 bytes and written 308 bytes 
--- 
New, (NONE), Cipher is (NONE) 
Secure Renegotiation IS NOT supported 
Compression: NONE 
Expansion: NONE 
No ALPN negotiated 
SSL-Session: 
    Protocol : TLSv1.2 
    Cipher : 0000 
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Key-Arg : None 
    PSK identity: None 
    PSK identity hint: None 
    SRP username: None 
    Start Time: 1467812448 
    Timeout : 300 (sec) 
    Verify return code: 0 (ok) 
--- 
+1

делает телнет living-registry.com 5000 работает? – Fares

ответ

0

Для самоподписанных сертификатов, то элта должны быть скопированы в

/etc/docker/cert.d/hostname:port/ca.crt

КФА: https://docs.docker.com/engine/security/certificates/

я создаю сертификаты:

openssl req -x509 -nodes -days 3650d -newkey rsa:2048 -keyout /root/docker-registry/certs/registry.key -out /root/docker-registry/certs/registry.crt -days 3650d 

cp /root/docker-registry/certs/registry.crt /etc/docker/cert.d/x.x.x.x:5000/ca.crt 
+0

В этой справочной документации рассказывается о нескольких файлах сертификатов. Я только скопировал файл 'registry.crt'. Я не могу понять, как мне установить эти файлы сертификатов в свой файл '/etc/docker/certs.d/x.x.x.x: 5000 /'. Должен ли я скопировать файл '* .key' моего сертификата' .crt'? (Я добавил некоторые подробности в сообщении). – Jordi