The Registry is a stateless, highly scalable server-side application that stores and lets you distribute Docker images. The Registry is open-source, under the permissive Apache license.

Why use it

You should use the Registry if you want to:

  • tightly control where your images are being stored
  • fully own your images distribution pipeline
  • integrate image storage and distribution tightly into your in-house development workflow ReadMore


The Registry is compatible with Docker engine version 1.6.0 or higher.

Type below command in your terminal to find your version.

docker --version
Docker version 20.10.6, build 370c289

Now create a docker-compose file and pas the below code


            – 5000:5000
            REGISTRY_AUTH_HTPASSWD_REALMRegistry Realm  
            – .:/var/lib/registry
            – .:/auth

run the below code in your terminal to create htpassed file, don’t forget to change the username and password

docker run \
    –entrypoint htpasswd \
    httpd:2 -Bbn admin admin > htpasswd

You have your htpasswd file which stores your username and password in bcrypt type

It is time to bring up our container 

docker-compose up -d


Now login to your private registry

docker login localhost:5000

username: admin

password: admin

Pull (or build) some image from the hub

docker pull ubuntu

Tag the image so that it points to your registry

docker image tag ubuntu localhost:5000/myfirstimage

Push it

docker push localhost:5000/myfirstimage

Pull it back

docker pull localhost:5000/myfirstimage

check how many images do we have in registry, past in your browser

to check your repository inside registry

docker exec -it registry sh

cd /var/lib/registry/docker/registry/v2/repositories

Now stop your registry and remove all data

docker container stop registry && docker container rm -v registry


We have learned how to deploy a private docker registry with a username and password

Key Point:

Creat private registry

Log in to the private registry

push image

pull image