Private Docker Registry Using Self-Signed Certificates

I want to run a private docker registry that is widely available. Therefore, I can push images from other servers.

I follow these tutorials: doc1 and doc2

I followed 3 steps: First I created my certificate and key (as CNAME I filled in my ec2-hostname)

mkdir -p certs && openssl req \
  -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \
  -x509 -days 365 -out certs/domain.crt

Than I created the docker registry using this key.

docker run -d -p 5000:5000 --restart=always --name registry \
  -v `pwd`/certs:/certs \
  -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
  -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
  registry:2

Than I copied the contents domain.crtto /etc/docker/certs.d/ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/ca.crt I restarted my docker: sudo service docker restart When I try to click on the image, I get the following error:

unable to ping registry endpoint https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v0/
v2 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v2/: net/http: TLS handshake timeout
 v1 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v1/_ping: net/http: TLS handshake timeout

I really don’t know what I am missing or something is wrong. Can someone please help me. Thanks

+4
2

, / pwd ... /etc/docker/ certs.d

etc/docker/ cert.d/registry.ip:5000/domain.crt

0

"- TLS". , 5000 ( netstat), , ( AWS).

0

Source: https://habr.com/ru/post/1620106/


All Articles