Docker containers and their usage have revolutionized the way applications and the underlying operating system are packaged and deployed to development, testing, and production systems.

Docker Hub is the original registry for Docker container images and it is being joined by more and more publicly available registries such as the Google Container Registry and others.

Docker Registry

  • Storage for the Registry
  • Maintaining the Registry IP Address

If you want to enrich your career and become a professional in Docker, then visit Tekslate - a global online training platform: "Docker Training"   This course will help you to achieve excellence in this domain.

To deploy the integrated Docker registry, use the oadm registry command as a user with cluster administrator privileges. For example:

$ oadm registry --config=/etc/origin/master/admin.kubeconfig

--credentials=/etc/origin/master/openshift-registry.kubeconfig

--images='registry.access.redhat.com/openshift3/ose-${component}:${version}'

This creates a service and a deployment configuration, both called docker-registry. Once deployed successfully, a pod is created with a name similar to docker-registry-1-cpty9.

To see a full list of options that you can specify when creating the registry:

$ oadm registry --help

Storage for the Registry

The registry stores Docker images and metadata. If you simply deploy a pod with the registry, it uses an ephemeral volume that is destroyed if the pod exits. Images anyone has built or pushed into the registry would disappear. For production use, attach a remote volume or define and use the persistent storage method of your choice.

Example: To use an existing persistent volume claim:

$ oc volume deploymentconfigs/docker-registry --add --name=v1 -t pvc 

--claim-name=<pvc_name> --overwrite

Or, to attach an existing NFS volume to the registry:

$ oc volume deploymentconfigs/docker-registry

--add --overwrite --name=registry-storage --mount-path=/registry

--source='{"nfs": { "server": "<fqdn>", "path": "/path/to/export"}}'

Maintaining the Registry IP Address

OpenShift refers to the integrated registry by its service IP address, so if you decide to delete and recreate the docker-registry service, you can ensure a completely transparent transition by arranging to re-use the old IP address in the new service. If a new IP address cannot be avoided, you can minimize cluster disruption by rebooting only the masters.

Re-using the Address

To re-use the IP address, you must save the IP address of the old docker-registry service prior to deleting it, and arrange to replace the newly assigned IP address with the saved one in the new docker-registry service.

 Note the ClusterIP for the service:

$ oc get svc/docker-registry -o yaml | grep clusterIP:

Delete the service:

$ oc delete svc/docker-registry dc/docker-registry

Create the registry definition in registry.yaml, replacing <options>

with,

example, those used in step 3 of the instructions in the  section:

$ oadm registry <options> -o yaml > registry.yaml

Edit registry.yaml, find the Service there, and change its ClusterIP to the address noted in above.

Create the registry using the modified registry.yaml:

$ oc create -f registry.yaml

 

For an in-depth understanding of Docker click on: