Generate User and Password for Private Docker Registry
Execute openssl from folder : /mnt/d/localhub
Run the Docker Registry
Verify registry container started
Verify private registry login using user and password from STEP 1

Test the use of your private registry

Postman confirmation that vir_report is now in your private registry – YAY!!!
Also verify they are available on the local file system
Also works via browser

*** GOTCHA ***

For some reason, the htpasswd file is not working, so I had to get the registry password from the container logs
<strong>curl https://earnhardt-docker.duckdns.org/v2/_catalog</strong>
<strong><em>** Notice how Authorization is needed even with curl **</em></strong>
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Class":"","Name":"catalog","Action":"*"}]}]}

# You need to get the password from the container logs
# Here are two possible ways to get container logs:
1. From boomer-unraid:

   <strong>ssh root@boomer-unraid</strong>
   <strong>docker logs $(docker ps|grep registry|awk {'print $1'}) 2>&1|grep password|sed 's/.*password=/password=/g'"</strong>

   password="OXjyjUiyA**************zabkJFs" user=docker

2. From windows:
   
   <strong>plink -ssh root@boomer-unraid "docker logs $(docker ps|grep registry|awk {'print $1'}) 2>&1|grep password|sed 's/.*password=/password=/g'"</strong>

   <em>-| Password:
   - Keyboard-interactive authentication prompts from server: ------------------
   -Access granted. Press Return to begin session.
   - End of keyboard-interactive prompts from server ---------------------------
   password="OXjyjUiyA*********zabkJFs" user=docker</em>

--------------------------------------------------------------------------------
# <strong>Check the login:</strong>
<strong>docker login https://earnhardt-docker.duckdns.org</strong>
Username: docker
Password: <em>OXjyjUiyA*********zabkJFs</em>
<em>Login Succeeded</em>

# Use with curl:
<strong>curl -u docker:OXjyjUiyAVZXPSgdeJPLZr_Mw3PEGvUpXtShzabkJFs https://earnhardt-docker.duckdns.org/v2/_catalog</strong>
<em>{"repositories":["adhoc/vir_report","earnhardt/ps-perl","wordpress"]}</em>
--------------------------------------------------------------------------------

* windows: get_docker-regpass.cmd
<strong>Working Examples:</strong>
1. Get list of repositories
    <strong>curl -u docker:OXjyjUiyA**************zabkJFs https://earnhardt-docker.duckdns.org/v2/_catalog</strong>
    {"repositories":["adhoc/vir_report","earnhardt/ps-perl","wordpress"]}

2. Show tags for repository
    <strong>curl -u docker:OXjyjUiyA**************zabkJFs -X GET https://earnhardt-docker.duckdns.org/v2/wordpress/tags/list</strong>
    {"name":"wordpress","tags":["latest"]}

    <strong>curl -u docker:OXjyjUiyA**************zabkJFs -X GET https://earnhardt-docker.duckdns.org/v2/earnhardt/ps-perl/tags/list</strong>
    {"name":"earnhardt/ps-perl","tags":["v1"]}

    <strong>curl -u docker:OXjyjUiyA**************zabkJFs -X GET https://earnhardt-docker.duckdns.org/v2/adhoc/vir_report/tags/list</strong>
    {"name":"adhoc/vir_report","tags":["latest"]}

3. Pull a repository from registry
    <strong>docker pull earnhardt-docker.duckdns.org/earnhardt/ps-perl:v1</strong>
    v1: Pulling from earnhardt/ps-perl
    25ac27cfe874: Pull complete
    4705e5604283: Pull complete
    b1b1a3da7d3f: Pull complete
    d747e8313c8a: Pull complete
    53d9ee195005: Pull complete
    Digest: sha256:e927042e82e8af2b1425708354f5d918be8b909f1a4445f8fa1207cae666c73f
    Status: Downloaded newer image for earnhardt-docker.duckdns.org/earnhardt/ps-perl:v1
    earnhardt-docker.duckdns.org/earnhardt/ps-perl:v1

4. List the images
<strong>   docker images</strong>
   REPOSITORY                                       TAG           IMAGE ID       CREATED         SIZE
   earnhardt-docker.duckdns.org/earnhardt/ps-perl   v1            e927042e82e8   4 years ago     201MB

5. Extract image:
   <strong>docker save earnhardt-docker.duckdns.org/earnhardt/ps-perl:v1 --output earnhardt_ps-perl_v1.tar</strong>
   # Check for output:
   E:\work\myDocker>ls
   Volume in drive E is New Volume
   Volume Serial Number is 647D-66FE
   Directory of E:\work\myDocker
   03/17/2025  02:47 PM    <DIR>          .
   03/14/2025  12:07 PM    <DIR>          ..
   03/17/2025  02:47 PM        51,981,312 earnhardt_ps-perl_v1.tar
One thought on “docker login private registry”

Leave a Reply