The docker distribution package is available in the extras repository on CentOS 7.4. If it is disabled on your CentOS 7 system, you may need to enable it.
Installation Steps
1
Docker Distribution installation
Install the Docker Distribution package:
2
Configuring Docker Registry
The Docker registry configuration file is located at /etc/docker-distribution/registry/config.yml. It is in YAML format. If you need to make any changes, do so here.Example configuration file:
From the default configuration file:
- /var/lib/registry: Directory where Docker images will be stored
- Service: Binds to port 5000 on all network interfaces
3
SELinux and Firewall configuration
If the firewall is enabled and running, allow the port in the firewall:
4
Starting Docker Registry
Start the service and set it to start on boot:Verify that the Docker distribution service is running:
Adding Registry to Docker Engine
The following information will be used when Kubernetes 1.18.x and Docker applications are installed together in Apinizer installation.
1
Docker daemon.json configuration
Edit the /etc/docker/daemon.json file:Delete all lines in the file and add the following line:
It can also be added as
"insecure-registries" : ["192.168.X.X:5000"].2
Hostname configuration
If you don’t have a DNS server, use the /etc/hosts file to map the hostname to IP address:
If a hostname is written, it must be specified in the host files of other machines in the Kubernetes cluster.
3
Restarting Docker
Restart Docker to apply changes:
Docker Registry Usage
Follow the steps below to upload and manage images to the Private Docker Registry.1
Downloading image
Download images to the environment where Docker registry is installed:
2
Tagging image
Tag the image as dockerregistry.local:5000/manager:. This creates an additional tag for the existing image:
When the first part of the tag is a hostname and port, Docker interprets this as the location of a registry during push.
3
Pushing image to registry
Push the image to the local registry:
If the image upload was successful, you should get a sha256 hash at the end. Transferred images are stored under the /var/lib/registry/docker/registry/v2/repositories directory.
4
Repository check
Check the transferred images:
Example Usage
Loading Manager, Worker and Cache Images
To push images pulled to local registry:Loading Image from .tar File
Loading an Apinizer image received as .tar to registry:Adding Images to Local Docker Registry with Linux Shell Script
Automatic Image Loading Script
You can use the following script to automatically load Apinizer images to local Docker registry:Registry API Usage
Querying Catalog Information
To list all repositories in the registry:Listing Image Tags
To list tags of a specific image:Kubernetes Deployment Configuration
To use private registry in Apinizer deploy files in Kubernetes:Repository Cleanup
To delete images in the repository:Another issue to consider when installing Local Docker Registry is SSL.For more information: https://github.com/Juniper/contrail-docker/wiki/Configure-docker-service-to-use-insecure-registry

