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
curl https://earnhardt-docker.duckdns.org/v2/_catalog** Notice how Authorization is needed even with curl **
{"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:
ssh root@boomer-unraiddocker logs $(docker ps|grep registry|awk {'print $1'}) 2>&1|grep password|sed 's/.*password=/password=/g'"
password="OXjyjUiyA**************zabkJFs" user=docker
2. From windows:
plink -ssh root@boomer-unraid "docker logs $(docker ps|grep registry|awk {'print $1'}) 2>&1|grep password|sed 's/.*password=/password=/g'"-| 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
--------------------------------------------------------------------------------
# Check the login:docker login https://earnhardt-docker.duckdns.org
Username: docker
Password: OXjyjUiyA*********zabkJFsLogin Succeeded
# Use with curl:
curl -u docker:OXjyjUiyAVZXPSgdeJPLZr_Mw3PEGvUpXtShzabkJFs https://earnhardt-docker.duckdns.org/v2/_catalog{"repositories":["adhoc/vir_report","earnhardt/ps-perl","wordpress"]}
--------------------------------------------------------------------------------
* windows: get_docker-regpass.cmd
Working Examples:
1. Get list of repositories
curl -u docker:OXjyjUiyA**************zabkJFs https://earnhardt-docker.duckdns.org/v2/_catalog
{"repositories":["adhoc/vir_report","earnhardt/ps-perl","wordpress"]}
2. Show tags for repository
curl -u docker:OXjyjUiyA**************zabkJFs -X GET https://earnhardt-docker.duckdns.org/v2/wordpress/tags/list
{"name":"wordpress","tags":["latest"]}
curl -u docker:OXjyjUiyA**************zabkJFs -X GET https://earnhardt-docker.duckdns.org/v2/earnhardt/ps-perl/tags/list
{"name":"earnhardt/ps-perl","tags":["v1"]}
curl -u docker:OXjyjUiyA**************zabkJFs -X GET https://earnhardt-docker.duckdns.org/v2/adhoc/vir_report/tags/list
{"name":"adhoc/vir_report","tags":["latest"]}
3. Pull a repository from registry
docker pull earnhardt-docker.duckdns.org/earnhardt/ps-perl:v1
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
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
earnhardt-docker.duckdns.org/earnhardt/ps-perl v1 e927042e82e8 4 years ago 201MB
5. Extract image:
docker save earnhardt-docker.duckdns.org/earnhardt/ps-perl:v1 --output earnhardt_ps-perl_v1.tar
# 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
Nice