top of page


Docker Private Registry allows us to maintain a local repository of Docker image to access within a limited source of network or groups. Private docker registry is useful when you do not want to share a secure content of your docker on cloud or where you have a limited access to the internet or bandwidth for frequent request for docker image.

So lets see how we can get this setup on Centos7 :

1. Install docker registry package using yum :

[root@siddhesh ~]# yum install docker-distribution
[root@siddhesh ~]# yum info docker-distribution
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * remi-php70:
 * remi-php70-test:
 * updates:
Installed Packages
Name        : docker-distribution
Arch        : x86_64
Version     : 2.6.2
Release     : 2.git48294d9.el7
Size        : 12 M
Repo        : installed
From repo   : extras
Summary     : Docker toolset to pack, ship, store, and deliver content
URL         :
License     : ASL 2.0
Description : Docker toolset to pack, ship, store, and deliver content

[root@siddhesh ~]#

2. Configure Local Docker Registry :

Main configuration file of docker registry is /etc/docker-distribution/registry/config.yml

This configuration file is in yaml format where you can define directory path to save a docker images and port to listen registry service on.

[root@siddhesh ~]# cat /etc/docker-distribution/registry/config.yml
version: 0.1
    service: registry
        layerinfo: inmemory
        rootdirectory: /var/lib/registry
    addr: :5000
[root@siddhesh ~]#

Here :

rootdirectory is a path of your local repository

addr is port on which service will be listen

3. Start docker registry service.

You can now start the service and enable to start on boot.

[root@siddhesh ~]# systemctl start docker-distribution
[root@siddhesh ~]# systemctl enable docker-distribution
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/docker-distribution.service.
[root@siddhesh ~]#

You can verify this using telnet or netstat.

[root@siddhesh ~]# telnet localhost 5000
Connected to localhost.
Escape character is '^]'.

[root@siddhesh ~]# netstat -antup |grep 5000
tcp        0      0  *               LISTEN      3299/lua
tcp6       0      0 :::5000                 :::*                    LISTEN      3299/lua
[root@siddhesh ~]#

4. Setup insecure registry to local docker engine :

By default docker uses https(443) port to connect its registry. But in most of local docker registry we might use insecure registry as access to this registry from outside network is restricted at Network Layer.

For this add below line under docker engine daemon file :

[root@siddhesh ~]# cat /etc/docker/daemon.json
 "insecure-registries" : [""]
[root@siddhesh ~]# 

Here : is my host name of docker registry

5000 is port which open to accept connection from client.

Make sure you have run dns entry for under your dns server or add this entry in /etc/hosts file

[root@siddhesh ~]# ping -c 1
PING ( 56(84) bytes of data.
64 bytes from localhost ( icmp_seq=1 ttl=64 time=0.099 ms

--- ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.099/0.099/0.099/0.000 ms
[root@siddhesh ~]#

5. Lets push docker image to local registry :

To test this I'll download one light weight image of alpine from

[root@siddhesh ~]# docker pull alpine
Using default tag: latest
Trying to pull repository ...
latest: Pulling from
cbdbe7a5bc2a: Pull complete
Digest: sha256:9a839e63dad54c3a6d1834e29692c8492d93f90c59c978c1ed79109ea4fb9a54
Status: Downloaded newer image for
[root@siddhesh ~]#

Create a tag for this machine which will be in used while pushing image to local registry.

[root@siddhesh ~]# docker tag alpine

Now lets push this image using created tag to local registry.

[root@siddhesh ~]# docker push
The push refers to repository []
db584c622b50: Pushed 
52a7ea2bb533: Pushed 
52f389ea437e: Pushed 
88888b9b1b5b: Pushed 
a94e0d5a7c40: Pushed 
alpine: digest: sha256:52286464db54577a128fa1b1aa3c115bd86721b490ff4cbd0cd14d190b66c570 size: 1357
[root@siddhesh ~]#

Store image can be found under /var/lib/registry/docker/registry/v2/repositories

[root@siddhesh ~]# ls /var/lib/registry/docker/registry/v2/repositories
[root@siddhesh ~]#

bottom of page