All Courses
Docker Private registry

The docker private registry is a stateless, highly extensible server-side application. Distribute the Docker image. The registry is open source and is under an authorized Apache license.


You need to use the registry if:

  1. Tightly control the storage location of images
  2. Completely own the image delivery pipeline
  3. Tightly integrate image storage and delivery into custom development Workflow


Registration will start from here. –restart = always means (if you use the registry as part of your persistent infrastructure, you should set it to restart automatically when Docker restarts or exits).

$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
Docker Private registry - Pull complete

Check the registry container or do not use the following command:

$ docker ps
Docker Private registry - tcp registry

Pull (or build) some images from the hub

$ docker pull ubuntu

Tag the image to point to the registry

$ docker image tag ubuntu localhost:5000/my-ubuntu

Put it in your private registry

$ docker push localhost:5000/my-ubuntu

Try deleting the local image and pulling it from the local repository.

$ docker image remove ubuntu
$ docker image remove localhost:5000/my-ubuntu
$ docker pull localhost:5000/my-ubuntu

Stop registration here and delete all data

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


Customize the storage location

By default, registry data is stored on the host file system as a Docker volume. If you want to save the contents of the registry to a specific location on the host file system (for example, B. If you have the SSD or SAN mounted in a specific directory, you can choose to use bind-mount instead. Depends on the file system layout of the Docker host, but improves performance in many situations. The following example binds the /mnt/registry host directory to the registry container at the /var/lib/registry/.

$ docker run -d \
-p 5000:5000 \
--restart=always \
--name registry \
-v /mnt/registry:/var/lib/registry \

Gets a list of images in the private registry.

$ curl -X GET http://localhost:5000/v2/_catalog

If desired, all tags form a particular image.

curl -X GET http://localhost:5000/v2/my-ubuntu/tags/list

If you want to remove the tag first, you need to get the catalog and the tag and then use the following command:

curl -v –silent -H “Accept: application/vnd.docker.distribution.manifest.v2+json” -X GET
http://localhost:5000/v2/my-ubuntu/manifests/latest 2>&1 | grep Docker-Content-Digest | awk ‘{print

Docker Private registry - print

Execute the following command with the manifest value specified:

curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X

if you face the below error

Docker Private registry - registry storage

If you want to delete the image, you need to set the called environment variable

docker run -d -p 5000:5000 -e REGISTRY_STORAGE_DELETE_ENABLED=true --restart=always --
name registry registry:2

Install Jenkins using docker

$ docker run -p 8080:8080 -p 50000:50000 jenkins
This will store the workspace in /var/jenkins_home. All Jenkins data lives in there - including
plugins and configuration. You will probably want to make that a persistent volume


docker run -d -p 8080:8080 -p 50000:50000 -u root  v /Jenkins_home:/var/jenkins_home

You can run the build on the master (ready to use), but if you connect a build slave server:
Be sure to map the port: -p 50000: 50000-this is used when connecting slaves Agent.