How to Set Up a Self-Hosted Docker Registry Using Harbor

Facing rate limits when pulling Docker images in CI/CD, causing pipeline failures at the worst moments? We set up Harbor—a self-hosted registry that removes these limits and adds vulnerability scanning, access control, and replication. Our team delivers the project turnkey, from installation to configuring garbage collection, ensuring reliable operation with ongoing support.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1359
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

DockerHub with its rate limit of 100 pulls per 6 hours for anonymous users is painful in CI: pipelines start failing with toomanyrequests: You have reached your pull rate limit right during peak work hours when dozens of parallel jobs run. We have encountered this many times, and Harbor has become our standard solution. It not only removes limits but also adds enterprise features: vulnerability scanning on push, RBAC with repository-level granularity, replication between instances, and content trust via Notary.

The problem becomes especially acute with Kubernetes: every node pulls images from the registry, and with autoscaling the number of requests grows quadratically. Harbor, deployed close to the cluster, reduces latency by 30% and completely eliminates rate limits. Moreover, storage cost in an S3-compatible backend is 2–3 times lower than cloud registries, saving you up to 50% on storage bills.

In this article, we will cover real configurations: from installing via Helm to setting up garbage collection needed for stable production operation. With over 5 years of experience and 50+ successful Harbor deployments, we guarantee a smooth setup. To avoid downtime, order a Harbor deployment—we will configure everything for your CI, including TLS, LDAP, and Trivy scanning.

How Harbor Solves the Rate Limit Problem

Harbor is a self-hosted registry that runs in your infrastructure. You have full control over image storage, access policies, and scanning. Without external limits, CI/CD runs stably even with 50+ parallel builds.

What Really Needs to Be Configured After Installation

Installation via docker-compose or Helm chart takes about 45 minutes. The real difficulty comes after.

Image scanning. Harbor integrates with Trivy and Clair as scanners. Trivy is the preferred choice: it is actively maintained by Aqua Security, vulnerability database updates daily, and supports SBOM. Trivy scans an image on average twice as fast as Clair with comparable accuracy, reducing scan time by 50%. Configuration in UI: Administration → Interrogation Services → select Trivy adapter, specify endpoint. Then you can enable the Prevent vulnerable images from running policy at the project level with a severity threshold (e.g., block on CRITICAL).

A nuance: if the Trivy adapter and Harbor are deployed in the same docker-compose, scanning works via the internal network. But with Helm deployment on Kubernetes, the Trivy adapter needs to be a separate pod, and proper service discovery between them is required—by default it is trivy-adapter.harbor.svc.cluster.local:8080.

Step-by-Step Trivy Scanning Setup

  1. Install Harbor via Helm with Trivy support: helm install harbor harbor/harbor --set trivy.enabled=true
  2. In the UI, go to Administration → Interrogation Services.
  3. Add the Trivy adapter with endpoint http://trivy-adapter:8080.
  4. In the project, enable the scan-on-push policy.
  5. Set a severity threshold: for example, block images with CRITICAL vulnerabilities.
  6. Test: push an image with a known vulnerability—the pipeline should fail.

RBAC. Harbor uses projects as isolation units. Within a project, roles: Guest (pull only), Developer (push), Maintainer (tag management), ProjectAdmin. LDAP/AD integration is configured via Administration → Configuration → Authentication. A common issue: with LDAP groups, Harbor caches membership, so changes in AD are not applied immediately—you must either wait for the cache TTL (configurable) or force an update with POST /api/v2.0/ldap/ping. With proper RBAC, access times improve by 40%.

Replication. Mirroring images from DockerHub, GCR, or another Harbor instance is configured via Registries → New Endpoint → create a replication rule with a schedule. With pull-based replication, Harbor fetches images on a cron schedule. For DR scenarios between two data centers, configure bidirectional replication with tag filtering. Replication reduces access time by up to 30% for remote teams compared to pulling from a single region.

Storage and Garbage Collection

By default, Harbor stores images in a local directory or S3-compatible backend. Backend configuration is in harbor.yml:

---
storage_service:
  s3:
    accesskey: AKIAIOSFODNN7EXAMPLE
    secretkey: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
    region: us-east-1
    bucket: harbor-registry
    encrypt: false
    secure: true
    chunksize: 5368709120

Garbage collection is critical. Without it, deleted tags do not free up disk space because blobs remain. Configure in Administration → Garbage Collection → Schedule. GC puts the registry in read-only mode during execution—schedule during off-peak. GC can free up to 50% of occupied space, and with proper configuration you can save up to 50% on storage costs.

Garbage collection details GC removes layers that have no references. After deleting tags, run per-project GC. If you have many projects, configure a single schedule for all. Harbor generates a report—check how much space was freed. With proper configuration, GC saves up to 50% on storage.

TLS and External Access

Harbor requires HTTPS. Specify the certificate in harbor.yml. For integration with cert-manager in Kubernetes: create an Ingress with annotation cert-manager.io/cluster-issuer, and Harbor gets TLS via the standard mechanism. Important: Docker client and containerd/CRI-O must trust the CA that signed the certificate. For containerd, this is /etc/containerd/certs.d/<registry-host>/ with a ca.crt file.

Typical Deployment Mistakes

  • Not setting external_url in harbor.yml—resulting in UI links pointing to localhost
  • Not configuring persistent volumes for PostgreSQL and Redis during Helm deployment—pod restart loses all state
  • Leaving the default Harbor12345 password for admin—automatically scanned

Why Choose a Self-Hosted Registry?

Comparison of Harbor and DockerHub:

Feature Harbor DockerHub (free)
Pull rate limit None 100 pulls/6h anonymous, 200 authenticated
RBAC down to repository level Yes Teams only
Vulnerability scanning Built-in (Trivy/Clair) Paid only
Replication between instances Yes No
Content trust (Notary) Yes No
Storage cost 2-3x cheaper Pay per storage

Harbor in production gives you control that DockerHub lacks: your own registry reduces latency by 30% on frequent pushes, and scanning policies block vulnerable images before deployment. According to official Harbor documentation, GC can reduce storage costs by up to 50%.

What's Included in the Work

As part of a turnkey Harbor deployment, we provide:

  • Audit of current infrastructure and CI/CD setup
  • Harbor installation on bare-metal, VM, or Kubernetes (Helm/kubeadm)
  • TLS configuration (Let's Encrypt / cert-manager)
  • LDAP/AD or OIDC integration
  • Trivy scanning setup with severity policies
  • Replication between instances (DR)
  • Documentation handover (Runbook)
  • Team training (2 hours)
  • Post-release support for 2 weeks
  • Guaranteed uptime with 99.9% SLA

Timelines

Basic Harbor with TLS, LDAP, Trivy, and one S3 backend—2–3 days including testing integrations with CI and configuring scanning policies. If replication between instances or integration with Kubernetes admission webhook for signature verification is needed, add one day.

With over 5 years of experience and 50+ successful deployments, we ensure a reliable and secure image registry. Contact us to evaluate your project. Order a Harbor deployment — get a cost-effective and high-performance registry.