Closed AJNOURI closed 6 years ago
After some inspection, I found that I have created the htpasswd file under /home/ajn/auth with root privivileges:
[ajn@dockerstd1 ~]$ ls -la auth/htpasswd -rw-r--r--. 1 root root 67 Jan 24 23:49 auth/htpasswd [ajn@dockerstd1 ~]$
Might be the issue. So I removed the file and all images:
docker stop `docker ps -q`
docker rm `docker ps -a -q`
docker rmi `docker images -q` -f
docker pull registry:2
docker run --entrypoint htpasswd registry:2 -Bbn test password > auth/htpasswd
[ajn@dockerstd1 ~]$ docker run -d -p 5000:5000 -v /home/ajn/certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/dockerrepo.crt -e REGISTRY_HTTP_TLS_KEY=/certs/dockerrepo.key -v /home/ajn/auth:/auth -e REGISTRY_AUTH=htpasswd -e REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/home/ajn/auth/htpasswd registry:2
c7d88b8e2673bdc32bea2fae57c0917409c135b0de291cf99691188034beb34d
[ajn@dockerstd1 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c7d88b8e2673 registry:2 "/entrypoint.sh /etc_" 14 seconds ago Up 13 seconds 0.0.0.0:5000->5000/tcp compassionate_neumann [ajn@dockerstd1 ~]$
So far looks OK.
docker pull busybox
docker tag busybox myregistry.ajnouri.com:5000/my-busybox
But when trying to log:
docker login myregistry.ajnouri.com:5000/my-busybox
Username: test Password: Error response from daemon: Get https://myregistry.ajnouri.com:5000/v2/: x509: certificate signed by unknown authority
After correcting several issues:
Still having an error when connecting to the registry:
[ajn@dockerstd1 ~]$ docker login myregistry.ajnouri.com:5000/my-busybox
Username: test Password: Error response from daemon: Get https://myregistry.ajnouri.com:5000/v2/: http: server gave HTTP response to HTTPS client
===> this is solved here https://github.com/AJNOURI/Docker_Certified_Associate_Certification/issues/9!!!
Ok, solved the issue. I 've tried to spot the issues I encountered and that was a conglomerate of errors:
[ajn@dockerstd1 ~]$docker login myregistry.ajnouri.com:5000/my-busybox
Username: test Password: Login Succeeded
Configuring private docker registry with self-signed certification.
Connection to the new registry is refused :
here is the prior configurations:
openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/dockerrepo.key -x509 -days 365 -out certs/dockerrepo.crt -subj /CN=myregistry.ajnouri.com
And when trying to login:
[root@dockerstd1 myregistry.ajnouri.com:500]#
docker login myregistry.ajnouri.com:5000/mybusybox