Install certificate on Centos 7 for docker registry access -


we have docker registry setup, has security. normally, in order access it, developer's perspective, have long docker login --username=someuser --password=somepassword --email user@domain.com https://docker-registry.domain.com.

however, since trying automatized deployment of docker container in cloud, 1 of operations, docker pull command, fails because login not performed (it works if add login in template, that's bad).

i suggested use certificate allow pull being done (.crt file). tried installing certificate using steps explained here: https://www.linode.com/docs/security/ssl/ssl-apache2-centos

but not seem work, still have manual login in order able perform docker pull registry.

is there way can replace login command use of certificate?

as see, it's wrong url ssl authentication between docker server , private registry server.

you can follow this:

running domain registry

while running on localhost has uses, people want registry more available. so, docker engine requires secure using tls, conceptually similar configuring web server ssl.

get certificate

assuming own domain myregistrydomain.com, , dns record points host running registry, first need certificate ca.

create certs directory:

 mkdir -p certs 

then move and/or rename crt file to: certs/domain.crt, , key file to: certs/domain.key.

make sure stopped registry previous steps, start registry again tls enabled:

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 

you should able access registry docker host:

docker pull ubuntu docker tag ubuntu myregistrydomain.com:5000/ubuntu docker push myregistrydomain.com:5000/ubuntu docker pull myregistrydomain.com:5000/ubuntu 

gotcha

a certificate issuer may supply intermediate certificate. in case, must combine certificate intermediate's form certificate bundle. can using cat command:

cat domain.crt intermediate-certificates.pem > certs/domain.crt 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -