How do I setup / install a Docker registry?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7

Issue

  • I would like to setup and install a docker registry, can this be done?

Resolution

  1. Install the Docker Registry

    # yum install docker-distribution
    
  2. Start the Docker Registry Service

    # systemctl start docker-distribution.service
    
    • You may want to have this start by default on boot, if so make sure you enable the service on.
    # systemctl enable docker-distribution.service
    

Note: If the private registry requires to be secured, then follow the steps mentioned in the kbase article How to secure private docker registry on Red Hat Enterprise Linux 7 ?

Note: If docker-distribution use aws s3 storage, refer to Why container image push to a private registry configured with docker-distribution-2.6.2-2.git48294d9.el7 and AWS S3 storage fails with an "internal server" error ? .

Interacting and using your private registry

Getting an image from a registry

  1. Pull an image from the Content from index.docker.io is not included.Public Repository or use registry.access.redhat.com to get images directly from Red Hat.

    docker pull registry.access.redhat.com/rhel
    
    • You can also pull from your private registry (after images have been uploaded by specifying the registry location at the end of the pull command):
    docker pull myregistry.example.com:5000/rhel7
    
  2. Then, find the image id that corresponds to the fedora repository, and pull the latest tag'ed image.

    docker images | grep rhel | grep latest
    registry.access.redhat.com/rhel                   latest              db7a70a0414e        3 hours ago         195.9 MB
    

Pushing an Image to a registry

Note:

If the private registry is not secured by a TLS/SSL certificate or configured using a self signed certificate which is not imported in the client, then add the registry to the insecure block and then restart the docker daemon. Edit the file /etc/containers/registries.conf and then registry details. Example

[registries.insecure]
registries = ['192.168.122.80:5000']
  1. Create a tag for this image and point it at your private registry

    docker tag db7a70a0414e myregistry.example.com:5000/rhel7
    
  2. Push the image to the new registry to store it in its new home location.

    docker push myregistry.example.com:5000/rhel7
    
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.