Host your own container registry
Here's a little personal project that I share here in a blog post. I'm developing a small application in my "lab" and I want it to be in a container. This application will run on a well known containers and services workload manager, Kubernetes.
For this, I need to build the container image and make it available so that Kubernetes can retrieve it and create an instance from it. This is the genesis of my search for a solution to host a container registry. This is how I discovered Harbor.
Harbor is an open source application that allows you to host your own registry service. The best known Public Cloud equivalents are :
- Amazon ECR (https://aws.amazon.com/ecr/)
- Azure ACR (https://azure.microsoft.com/en-us/services/container-registry/)
- GCP Container Registry (https://cloud.google.com/container-registry/)
Without further ado, let's get to the heart of the matter and move on to the installation of the solution.
A minimum of 2 CPU, 2 GB RAM and 40 GB disk space is required (https://goharbor.io/docs/1.10/install-config/installation-prereqs/). This is perfect for my homelab.
Docker engine and Docker compose must also be installed. We will not detail here how to perform these basic steps.
The installation is simple and well described in the official documentation (https://goharbor.io/docs/1.10/).
From the following GitHub page https://github.com/goharbor/harbor/releases, you need to download (with
wget, for example) the latest version of the installation utility.
wget https://github.com/goharbor/harbor/releases/download/version/harbor-online-installer-version.tgz tar xvf harbor-online-install-version.tgz
We extract the contents of the archive:
tar xvf harbor-online-install-version.tgz
The service, within my homelab, is not directly exposed on the Internet. So I voluntarily omitted the HTTPS configuration part (https://goharbor.io/docs/1.10/install-config/configure-https/). In my case, the HTTPS termination is carried by another server (reverse proxy).
To configure the service before installation, just edit the harbor.yml file contained in the previously extracted folder. It is possible to enter a certain amount of information (domain name, external URL, external database settings...), everything is detailed in the following documentation: https://goharbor.io/docs/1.10/install-config/configure-yml-file/.
Once the changes have been made in the configuration file, the installation can be launched.
It is possible to install additional services with Harbor, such as Clair for static analysis of images (article to come on the subject) or Notary for content signing.
The simple installation option is as follows:
To install Harbor with CoreOS Clair, here is the command to execute :
That's it, the service is installed and you just have to go to the configured URL to finalize the configuration of the service.
The home page, once the service is configured :
There you go, all you have to do is build images!