A Harbor portal that opens over HTTPS is only the beginning of a registry certificate deployment. Docker clients, containerd hosts, Kubernetes image pulls, robot accounts and replication jobs all depend on the registry identity and its trust chain. This guide uses an externally issued certificate with Harbor's installer-managed configuration, then checks a real push-and-pull path so the result matters to deployments rather than only to a browser.
Release assumption: a Harbor 2.x deployment installed from the official installer bundle and managed with Docker Compose. Use the documentation and prepare program from the exact installed Harbor release; the main documentation is a moving reference checked in November 2026. A Helm deployment has a different configuration and secret model and should use its chart's instructions instead. These examples do not install a fresh registry or replace its existing database and artifact storage.
The public identity will be registry.example.com on the standard HTTPS port. Keep your existing Harbor project settings, scanner choices, storage location and external integrations. A certificate change is not an excuse to run destructive cleanup commands or recreate persistent state.
Step 1: Inventory registry consumers and preserve the installer state
Find the directory containing harbor.yml, prepare and the generated Compose definition. Record the current Harbor version and enabled components. Installer flags matter: regenerating configuration without previously enabled components can change more than the certificate. Read the old installation record or effective Compose services before planning the maintenance command.
Back up harbor.yml, generated configuration and the current certificate pair to protected storage. Follow your established consistent backup procedure for databases and artifact data, but do not copy live database directories and call that a consistent backup. The certificate workflow should preserve those directories throughout.
cd /opt/harbor
sudo docker compose ps
sudo install -d -m 0700 /root/harbor-tls-before
sudo cp -a harbor.yml docker-compose.yml common/config /root/harbor-tls-before/The installation path is an example; use the real installer directory. If generated files have different names in your release, back up those actual files instead. Also record a known test repository and an existing image digest. A stable digest gives you a way to confirm that storage and pulls still work after reconfiguration.
List remote build runners, deployment nodes and replication partners. Some may connect through an old hostname or nonstandard port. A certificate for registry.example.com cannot authenticate registry.internal merely because both addresses reach Harbor. Standardize the intended registry name before making trust exceptions on many clients.
Step 2: Obtain an external certificate through a challenge CNAME
Prepare registry.example.com in SimpleACME and activate paid update access. Add the portal's exact generated CNAME at _acme-challenge.registry.example.com. Keep the registry's ordinary address record pointed at Harbor. Delegating the challenge does not delegate image storage or expose a Harbor API endpoint.
Use the maintained Certbot instructions for an external ACME client and consult the update API reference for the registration authentication model. SimpleACME receives delegated TXT values. The client requests the certificate, owns its private key and decides when issuance has completed successfully. A prepared demo domain intentionally cannot update until paid entitlement is active.
DNS-01 fits a private registry because the certificate authority can validate public DNS while registry traffic remains restricted to approved networks. You do not need to expose an HTTP challenge solely for renewal, nor give the registry a broad credential for your normal DNS zone. Public challenge resolution and outbound client access remain requirements, so test them before scheduling a production rotation.
Prefer a certificate dedicated to the registry's real identifier unless you have a documented reason to share a wildcard. A wildcard's private key can authenticate more names, which changes the impact of exposing it to build infrastructure. In either case, inspect the issued SANs and full chain rather than inferring coverage from a product name.
Step 3: Configure Harbor's external HTTPS files
Install the issued full chain and matching private key in a protected, stable directory on the Harbor host. Harbor's prepare process consumes the configured paths and generates component configuration, so changing only a random file inside a running container is neither a durable nor an auditable setup.
sudo install -d -m 0700 /opt/harbor/tls
sudo install -m 0644 /etc/letsencrypt/live/registry.example.com/fullchain.pem \
/opt/harbor/tls/fullchain.pem
sudo install -m 0600 /etc/letsencrypt/live/registry.example.com/privkey.pem \
/opt/harbor/tls/privkey.pemMerge the following fields into the existing harbor.yml, keeping the rest of the file intact. If external_url is already set, ensure it agrees with the intended public registry address and review its release-specific behavior; do not leave contradictory public addresses. Official Harbor documentation supports existing third-party certificates rather than requiring its self-signed example. Harbor HTTPS configuration.
hostname: registry.example.com
https:
port: 443
certificate: /opt/harbor/tls/fullchain.pem
private_key: /opt/harbor/tls/privkey.pemBefore preparing, inspect the candidate certificate and key match. Keep each certificate generation together in staging and serialize deployment. Preserve security labels and directory ownership appropriate to your Docker installation. Do not make the key broadly readable merely to work around a failed prepare command; inspect the exact error and the documented host path requirements.
Client-facing HTTPS and Harbor's optional internal component TLS are different layers. The former authenticates the registry to users and Docker clients. Enabling internal TLS changes component-to-component communication and certificate management and should be handled as a separate project rather than slipped into a renewal operation.
Step 4: Regenerate configuration without deleting registry data
Use your version's documented reconfiguration procedure and the prepare tool shipped with that installer. Plan downtime because configuration regeneration and component recreation can interrupt pushes. Preserve any feature flags required by your existing installation, such as the scanner option used at installation time. The official lifecycle guide describes regeneration and Compose management. Harbor reconfiguration and lifecycle.
cd /opt/harbor
sudo docker compose stop
sudo ./prepare
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs --tail=100 proxy core registryThe prepare invocation above assumes the base component set. Add only the documented options matching the already-installed features. Confirm service names with docker compose config --services if your generated definition differs. Never use down -v as a routine certificate step; removing volumes is unrelated to loading a new server certificate and can threaten persistent data in some deployments.
Check the newly served certificate with SNI from outside the Docker host. Then request /v2/. An unauthenticated registry response can legitimately be 401 with a WWW-Authenticate challenge, so do not treat that response alone as a failed TLS installation. It proves a different stage than an authenticated image operation.
openssl s_client -connect registry.example.com:443 \
-servername registry.example.com -verify_return_error </dev/null
curl --show-error --include https://registry.example.com/v2/If you see the wrong certificate, inspect the generated proxy configuration, the active container mounts and the actual external endpoint. A DNS load balancer or an older edge proxy can be the listener clients reach. Re-running ACME issuance will not fix a server that is consuming a different file.
Step 5: Prove push, pull and renewal behavior
Use a dedicated test project and a minimally scoped robot account for a controlled push and pull. Supply credentials through the Docker client's supported password-input mechanism rather than exposing them in command history. Check the pushed image digest, pull it on a representative deployment node and compare the digest again.
For public-CA certificates with a complete chain, clients should normally use their established trust stores. Do not mark the registry insecure to bypass a chain error. Private-CA installations require the appropriate daemon trust configuration on every relevant runtime, but that is a separate trust-distribution decision and should not be confused with converting the server certificate's filename extension.
Check replication jobs, webhooks and scanner access after the registry becomes healthy. A user interface login does not prove a remote replication partner trusts the new chain. Kubernetes image pulls are especially useful as a representative check because the node's runtime, rather than your laptop, performs the TLS connection.
For renewal, deploy only after the ACME client reports successful issuance and the candidate passes validation. Preserve the old matching pair and configuration, run the version-matched regeneration process, and confirm a new handshake serves the new serial. Do not assume a plain container restart incorporates a changed source file if prepare previously copied it into generated configuration.
Rollback restores the previous unexpired certificate pair and harbor.yml, regenerates with the same installed feature options, and starts the existing stack against its preserved storage. Verify image pulls and the reference digest after recovery. Alert independently on certificate expiry, issuance failure and deployment failure. SimpleACME TXT activity helps explain challenge timing, but cannot prove Harbor accepted a replacement or that every container runtime can pull from it.
Distinguish registry authentication from certificate trust
Docker's registry flow may involve both a registry request and an authentication challenge naming a token service. Inspect the advertised endpoints when the portal works but docker login or image pulls fail. A stale hostname in generated configuration can send the client to a different address, so the certificate on the first page is not the entire connection path.
Keep the robot account's permissions limited to the chosen test project and remove or rotate temporary credentials according to your policy. TLS maintenance should not require an administrator account in every build runner. If an image operation is denied after a successful handshake, inspect the project and robot scope before weakening the registry's certificate validation.
For Kubernetes, choose a test workload whose image pull actually reaches the registry rather than succeeding from a node cache. Use a controlled test tag or digest and the cluster's established image-pull secret mechanism. Do not force deletion of production images or node caches merely to create a stronger certificate test.
Also document any registry mirrors or caching proxies in the deployment path. A successful pull through a mirror might not exercise Harbor's live listener at all. The direct Harbor handshake and a representative runtime pull answer complementary questions; retaining both results helps distinguish an external cache problem from a failed Harbor certificate promotion.
Frequently asked questions
Can I keep Harbor private while renewing certificates?
Yes. DNS-01 validates the delegated public challenge without inbound HTTP access to Harbor. Your ACME client still needs outbound connectivity, and the CNAME must resolve publicly. Registry firewall and access-control rules should remain intentional and separate.
Should I install the certificate inside the proxy container?
Use Harbor's durable host configuration and prepare workflow. Ad hoc changes inside a running container can disappear during recreation and leave harbor.yml inconsistent with the active service. Treat generated container configuration as an output of the installer process.
Is a 401 from the registry endpoint an HTTPS failure?
Not necessarily. An unauthenticated Docker Registry API request commonly receives an authentication challenge. Verify TLS first, then use an authorized test account to confirm image operations and project permissions.
Does this also enable internal Harbor TLS?
No. Client-facing registry HTTPS and internal component encryption are separate configurations. Keep the existing internal topology unchanged for this certificate deployment, then evaluate internal TLS with the dedicated official guide if required.