Install Docker Registry and WEB UI

Docker

What Docker Registry is?

Docker 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

Install Docker Registry and WEB UI

Install Docker Registry

Run under command:

docker run -d -p 5000:5000 --restart=always --name registry-srv registry:2

Explain:

  • registry-srv ->  container name
  • -p 5000:5000 -> map port 5000 of host and container
  • –restart=always -> alway start container
  • registry:2 ->  image name

Install  Web UI for Registry

Make config file:

mkdir -p /opt/conf

cd  /opt/conf

nano config.yml

File content:

registry:
   # Docker registry url
   url: http://registry-srv:5000/v2
   # Docker registry fqdn
   name: localhost:5000
   # To allow image delete, should be false
   readonly: false
   auth:
   # Disable authentication
   enabled: false

Explain:

  • readonly: false -> can delete image
  • enabled: false -> Disable authentication

Install Web UI for Registry :

docker run -it -p 8080:8080 --restart=always --name registry-web --link registry-srv -v $(pwd)/config.yml:/conf/config.yml:ro hyper/docker-registry-web

Explain:

  • registry-web -> container name
  • -p 8080:8080 -> map port 8080 of host and container
  • –restart=always -> alway start container
  • hyper/docker-registry-web -> image name

Access http://IP:8080

How to use Docker Registry

Pull Centos Image

[[email protected] ~]# docker pull centos:latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
aeb7866da422: Pull complete
Digest: sha256:67dad89757a55bfdfabec8abd0e22f8c7c12a1856514726470228063ed86593b
Status: Downloaded newer image for docker.io/centos:latest
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/centos latest 75835a67d134 33 hours ago 200 MB
[[email protected]calhost ~]#

Make image tag

 docker image tag centos 192.168.1.93:5000/centos:latest

Push image to Docker Registry

Https error:

[[email protected] ~]# docker push 192.168.1.93:5000/centos:latest
The push refers to a repository [192.168.1.93:5000/centos]
Get https://192.168.1.93:5000/v1/_ping: http: server gave HTTP response to HTTPS client

How to Fix?

  • For docker-io edit file /etc/docker/daemon.json and add { “insecure-registries”:[“192.168.1.93:5000”] }
  • For docker ce: edit file /usr/lib/systemd/system/docker.service. Find ExecStart=/usr/bin/dockerd
    and replace ExecStart=/usr/bin/dockerd –insecure-registry 192.168.1.93:5000 -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
  • Restart service by command: systemctl daemon-reload and systemctl restart docker

Try push image again

[[email protected] ~]# docker push 192.168.1.93:5000/centos:latest
The push refers to a repository [192.168.1.93:5000/centos]
f972d139738d: Pushed
latest: digest: sha256:dc29e2bcceac52af0f01300402f5e756cc8c44a310867f6b94f5f7271d4f3fec size: 529

Refresh Web UI page

Try pull pushed image

[[email protected] ~]# docker pull 192.168.1.93:5000/centos:latest
Trying to pull repository 192.168.1.93:5000/centos ...
latest: Pulling from 192.168.1.93:5000/centos
aeb7866da422: Pull complete
Digest: sha256:dc29e2bcceac52af0f01300402f5e756cc8c44a310867f6b94f5f7271d4f3fec
Status: Downloaded newer image for 192.168.1.93:5000/centos:latest

Source: https://hub.docker.com/r/hyper/docker-registry-web/

Share: