CentOS 7
Sponsored Link

Docker : Use Docker-Registry#1
2015/12/17
 
Install Docker-Registry to build Private Registry for Docker images.
[1] Install Docker-Registry on a Host you'd like to configure as a Registry Server.
[[email protected] ~]#
yum -y install docker-registry
[[email protected] ~]#
vi /etc/docker-registry.yml
# line 19: add

search_backend: _env:SEARCH_BACKEND
:sqlalchemy
# line 21: specify DB file for search (change it if need)

sqlalchemy_index_database: _env:SQLALCHEMY_INDEX_DATABASE:sqlite:////tmp/docker-registry.db
# line 74: the directory to store images (change it if need)

storage_path: _env:STORAGE_PATH:/var/lib/docker-registry
# create a directory to store images

[[email protected] ~]#
mkdir /var/lib/docker-registry

[[email protected] ~]#
systemctl start docker-registry

[[email protected] ~]#
systemctl enable docker-registry
# make sure to be able to access

[[email protected] ~]#
curl localhost:5000

"\"docker-registry server\""
[2] When using Registry Server from Docker Nodes, Docker Service accesses with HTTPS by default, but if you'd like to access with HTTP, it needs to change settings on each Docker Node like follows.
For settings of HTTPS accessing, refer to here.
[[email protected] ~]#
vi /etc/sysconfig/docker
# line 23: uncomment and specify Docker-Registry server

INSECURE_REGISTRY='--insecure-registry
dlp.srv.world:5000
'
[[email protected] ~]#
systemctl restart docker
[3] After settings above, it's possible to use Registry Server.
The follows are for the case of pushing images to Registry Server.
# add a tag and push

[[email protected] ~]#
docker tag web_server dlp.srv.world:5000/httpd

[[email protected] ~]#
docker push dlp.srv.world:5000/httpd

[[email protected] ~]#
docker images

REPOSITORY                    TAG       IMAGE ID        CREATED              VIRTUAL SIZE
web_server                    latest    4d62ac763587    About a minute ago   282.8 MB
dlp.srv.world:5000/httpd   latest    4d62ac763587    About a minute ago   282.8 MB
docker.io/centos              latest    14dab3d40372    36 hours ago         194.7 MB
[4] The follows are for the case of pulling images from Registry Server.
[[email protected] ~]#
docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

# search Registry Server with a word "httpd"

[[email protected] ~]#
docker search dlp.srv.world:5000/httpd

INDEX          NAME                                  DESCRIPTION   STARS     OFFICIAL   AUTOMATED
srv.world   dlp.srv.world:5000/library/httpd                 0

[[email protected] ~]#
docker pull dlp.srv.world:5000/httpd

[[email protected] ~]#
docker images

REPOSITORY                    TAG      IMAGE ID        CREATED             VIRTUAL SIZE
dlp.srv.world:5000/httpd   latest   4d62ac763587    14 minutes ago      282.8 MB