For C2D, Set Up Private Docker Registry

Learn how to setup your own docker registry and push images for running algorithms in a C2D environment.

The document is intended for a production setup. The tutorial provides the steps to set up a private docker registry on the server for the following scenarios:

  • Allow registry access only to the C2D environment.

  • Anyone can pull the image from the registry but, only authenticated users will push images to the registry.

Setup 1: Allow registry access only to the C2D environment

To implement this use case, 1 domain will be required:

  • example.com: This domain will allow only image pull operations

Note: Please change the domain names to your application-specific domain names.

1.1 Prerequisites

  • A docker environment running on a Linux server.

  • Docker compose is installed.

  • C2D environment is running.

  • The domain names are mapped to the server hosting the registry.

1.2 Generate certificates

# install certbot: https://certbot.eff.org/
sudo certbot certonly --standalone --cert-name example.com -d example.com

Note: Check the access right of the files/directories where certificates are stored. Usually, they are at /etc/letsencrypt/.

1.3 Generate a password file

Replace content in <> with appropriate content.

1.4 Docker compose template file for registry

Copy the below yml content to docker-compose.yml file and replace content in <>.

1.5 Nginx configuration

Copy the below nginx configuration to a nginx.conf file.

1.6 Create Kubernetes secret in C2D server

Login into the compute-to-data environment and run the following command with the appropriate credentials:

1.7 Update operator-engine configuration

Add PULL_SECRET property with value regcred in the operator.yml file of operator-engine configuration. For more details on operator-engine properties refer to the operator-engine readme.

Apply updated operator-engine configuration.

Steup 2: Allow anonymous pull operations

To implement this use case, 2 domains will be required:

  • example.com: This domain will only allow image push/pull operations from authenticated users.

  • readonly.example.com: This domain will allow only image pull operations

Note: Please change the domain names to your application-specific domain names.

2.1 Prerequisites

  • Running docker environment on the Linux server.

  • Docker compose is installed.

  • 2 domain names are mapped to the same server IP address.

2.2 Generate certificates

Note: Do check the access right of the files/directories where certificates are stored. Usually, they are at /etc/letsencrypt/.

2.3 Generate a password file

Replace content in <> with appropriate content.

2.4 Docker compose template file for registry

Copy the below yml content to docker-compose.yml file and replace content in <>. Here, we will be creating two services of the docker registry so that anyone can pull the images from the registry but, only authenticated users can push the images.

2.5 Nginx configuration

Copy the below nginx configuration to a nginx.conf file.

Start the registry

Working with registry

Login to registry

Build and push an image to the registry

Use the commands below to build an image from a Dockerfile and push it to your private registry.

List images in the registry

Pull an image from the registry

Use the commands below to build an image from a Dockerfile and push it to your private registry.

Next step

You can publish an algorithm asset with the metadata containing the registry URL, image, and tag information to enable users to run C2D jobs.

Further references

Last updated

Was this helpful?