DEV Community

Cover image for How to Deploy your own Container Registry
Mustafa Challawala
Mustafa Challawala

Posted on • Updated on

How to Deploy your own Container Registry

Harbor is an open source trusted cloud native registry project that stores, signs, and scans content. Harbor extends the open source Docker Distribution by adding the functionalities usually required by users such as security, identity and management. Having a registry closer to the build and run environment can improve the image transfer efficiency. Harbor supports replication of images between registries, and also offers advanced security features such as user management, access control and activity auditing.

To learn more about Harbor just Visit: https://github.com/goharbor/harbor

-- Deployment Prerequisites for the Target Host

Hardware

The following table lists the minimum and recommended hardware configurations for deploying Harbor.

Resource | Minimum | Recommended

CPU | 2 CPU | 4 CPU
Memory | 4 GB | 8 GB
Disk | 40 GB | 160 GB

Software

The following table lists the software versions that must be installed on the target host.

Software | Version | Description

Docker engine | version 17.06.0-ce+ or higher | For installation instructions, see docker engine doc
Docker Compose | version 1.18.0 or higher | For installation instructions, see docker compose doc
Openssl | latest |is preferred Used to generate certificate and keys for Harbor

Network ports

Harbor requires that the following ports be open on the target host.

Port | Protocol | Description

443 | HTTPS | Harbor portal and core API accept HTTPS requests on this port. You can change this port in the configuration file.
4443 | HTTPS | Connections to the Docker Content Trust service for Harbor. Only required if Notary is enabled. You can change this port in the configuration file.
80 | HTTP | Harbor portal and core API accept HTTP requests on this port. You can change this port in the configuration file.

-- Installation Procedure

  1. Download and Unpack the Installer
  • Go to the Harbor releases page (https://github.com/goharbor/harbor/releases).

  • Download either the online or offline installer for the version you want to install

  • Use tar to extract the installer package:

    Online installer:

    bash $ tar xvf harbor-online-installer-version.tgz
    

    Offline installer:

    bash $ tar xvf harbor-offline-installer-version.tgz
    
  1. Configure the harbor.yml file.
    hostname: hostname.com
    http:
    port: 80
    harbor_admin_password: password
    database:
    password: password
    data_volume: /data

  2. Installation with Clair, and Chart Repository Service

    bash  $ sudo ./install.sh --with-clair --with-chartmuseum
    

Notes:
Managing Harbor Lifecycle
Stop Harbor:

bash $ sudo docker-compose stop

 Stopping nginx              ... done
 Stopping harbor-portal      ... done
 Stopping harbor-jobservice  ... done
 Stopping harbor-core        ... done   
 Stopping registry           ... done
 Stopping redis              ... done
 Stopping registryctl        ... done
 Stopping harbor-db          ... done
 Stopping harbor-log         ... done

Restart Harbor after Stopping:

bash $ sudo docker-compose start

 Starting log         ... done
 Starting registry    ... done
 Starting registryctl ... done
 Starting postgresql  ... done
 Starting core        ... done
 Starting portal      ... done
 Starting redis       ... done
 Starting jobservice  ... done
 Starting proxy       ... done

Reconfigure Harbor

bash $ sudo docker-compose down -v
bash $ vim harbor.yml
bash $ sudo prepare --with-clair --with-chartmuseum
bash $ sudo docker-compose up -d




How to Access harbor-registry to Client machine

  1. Add registry to insecure registries

    bash $ sudo echo "{"insecure-registries":["hostname.com"]}" > /etc/docker/daemon.json
    
  2. Restart docker service

    bash $ sudo service docker restart
    
  3. Login to harbor registry

    bash $ sudo docker login http://hostname.com
    

Reference Link:

https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md

Top comments (0)