Introduction
When migrating Docker images from a Harbor registry to JFrog Artifactory, a common challenge arises if Artifactory is configured with the subdomain method (e.g., my-docker-repo.mycompany.com). It is a common misconception, sometimes reinforced by community discussions (like goharbor/harbor issue #13576), that Harbor's replication feature is incompatible with this setup and only supports the "repository path" method (e.g., mycompany.com/artifactory/my-docker-repo).
This article confirms that replication is fully compatible with the subdomain method and provides the correct configuration steps. The key to success is ensuring the Harbor "Registry Endpoint" is configured to point directly to the Artifactory Docker repository's full subdomain URL, not the base Artifactory server URL.
Resolution
Follow these steps to successfully configure push replication from Harbor to your Artifactory Docker repository.
Step 1: Create a Docker Repository in Artifactory
First, ensure you have a local Docker repository in Artifactory to serve as the destination.
- In your Artifactory UI, navigate to Administration > Repositories > Repositories.
Add a new Local Repository of the Docker package type.
Set a Repository Key (e.g., docker-local-migrated).
Click Save & Finish.
Step 2: Get Your Artifactory Credentials
You will need an Artifactory user (or a token) that has "Deploy/Write" permissions to the new docker-local-migrated repository.
Step 3: Create a Registry Endpoint in Harbor
Now, log in to your Harbor UI to teach it how to communicate with Artifactory.
- In Harbor, navigate to Administration > Registries.
- Click New Endpoint.
- Fill out the endpoint configuration:
- Provider: Select JFrog Artifactory.
- Name: Give it a clear name (e.g., artifactory-subdomain-dest).
- Endpoint URL: This is the most critical step. Enter the full URL to your Artifactory repository, using the subdomain method.
- Access ID: the email ID from your “set me up” page.
- Access Secret: Enter the token.
- Click Test Connection to verify Harbor can communicate with Artifactory.
- If successful, click OK to save the endpoint.
Note: Please use the URL and email copied in step 2 as Endpoint URL and access ID, respectively.
Step 4: Create a Replication Rule in Harbor
Finally, create the rule to push the images.
- In Harbor, navigate to Administration > Replications.
- Click New Replication Rule.
- Configure the rule:
- Name: Give the rule a name (e.g., migrate-to-artifactory).
- Replication Mode: Select Push-based.
- Source Resource Filter: Enter the images you want to replicate. To replicate everything, use **/**.
- Tag Filter: Enter the tags you want to replicate. To replicate all tags, use **.
- Destination Registry: Select the new endpoint you created in Step 3 (e.g., artifactory-subdomain-dest).
- Destination Namespace: (Optional) You can specify a namespace if needed.
- Trigger Mode: Choose your preferred method. For a one-time migration, you can select Manual and run it yourself.
For more information, you can refer to our official documentation.
- Click Save to create the rule.
If you set the trigger to "Manual," you can now select the rule from the list and click the Replicate button to begin the migration. You can monitor the progress under the "Executions" section.
Upon success, we should be able to see the images/artifacts in the Local Repository in JFrog Artifactory
Conclusion
By following these steps, we can successfully configure push replication from Harbor to an Artifactory instance that uses the Docker subdomain method. The key is ensuring the Harbor Registry Endpoint URL points directly to the full subdomain URL of the destination Docker repository, not the base URL of the Artifactory server. This process enables a straightforward migration path for teams moving from Harbor to Artifactory.