Hello everybody,
today I want to describe to ways of how private registry of docker can be used and created. Before I'll go in details of it's creation I want to point what is purpose of docker registry in itself. Imagine that you spent a lot of time and money in order to create your own docker image. And for some reasons you don't want to share it with whole world, just with your own customer. What you can do? You have two options:
- Use private docker registry
- Create your own docker registry
I will omit how to use 1 for now and will go directly to point 2.
There are two ways how to create local docker registry:
- Direct installation
- Registry image
Before you continue to any of two points, you'll need to have firewal opened on port 5000 ( if you like me use CentOS ). You can do it with following command:
firewall-cmd --zone=public --add-port=5000/tcp --permanent.
Direct installation or package manager
In general this way configures Docker registry with usage of yum or apt-get.
Following commands can bu usefull:
yum update
yum install docker-registry
systemctl start docker-registry
Registry image
In general this way uses Docker registry as Docker image-based container. You can use following commands:
docker pull registry:latest
docker run -p 5000:5000 registry:latest
systemctl start docker-registry
systemctl status docker-registry
Some notes.
As usually instead of docker run -p 5000:5000 registry:latest it is more practially to execute docker run -p -d 5000:5000 registry:latest, so to say to execute registry image in detached mode. If to execute without key -d then as soon as you enter Ctrl+C your docker registry image will cease to exist. Also without -d allow you to monitor visually all pushes and pulls from your local registry repository.