Subject The Harbor is an open-source registry and is a CNCF Graduate project that supports storing and managing docker images. Many developers and enterprises are using Harbor as a docker registry to manage docker images.
Artifactory is an enterprise-class artifacts management product and provides the docker type repository as the Docker registry to help manage the docker images. The benefits of Artifactory docker repository include Support for Multiple Docker Registries, OCI images, Docker Buildx, Unlimited Docker Hub access, and so on.
With the increasing demand for docker image storing and management, more and more users are using the Artifactory instead of the Harbor, and need to migrate the docker images in Harbor to Artifactory docker repository. The JFrog supports the Docker2Artifactory tool to help complete the migration job.
The Harbor supports managing different images through Projects. The docker repository in Artifactory is the same as the Project in Harbor. The Docker2Artifactory tool only supports copying the docker images from one Harbor project to one Artifactory docker repository. But sometimes customers want to migrate docker images under multiple projects in Harbor to the same Artifactory docker repository, which the tool does not support.
This article will show another way, using the Harbor replication function to migrate the docker images in multiple Harbor projects to one Artifactory docker repository at the same time.
Process Here are the steps of how to set the migration of the docker images from multiple Harbor projects to one Artifactory docker repository.
First, we need to create a docker local repository in the Artifactory to store and manage docker images.
Second, we need to add a registry for the Artifactory in the Harbor.
- The Provider selects JFrog Artifactory. If there is no JFrog Artifactory type, we can select the Docker hub type to replace it.
- The name is the registry name
- The Endpoint URL is the Artifactory URL, like http://<art-server:port>/artifactory/8082
- The Access ID is the Artifactory username that has the deploy permission for the docker repository
- The Access Secret is the user password.
After setting the config, we can click the test connection to test the connection with the Artifactory. If the test is OK, we can click the OK to save the config.
Third, we can create a replication job in the Harbor.
- The Name is the replication job name
- The Replication mode should be selected as Push-based, and it will push the images from Harbor to the Artifactory docker repository
- The Source resource filter supports filtering the Name, Tag, Label, and Resource for replication:
- Name: filter the name of the project and image name to migrate, which uses ** to match all, and the **/** will match all projects and all images in them
- Tag: filter the tag/version for the image. It also supports ** to match all, for example, the ‘1.0*’ will match the tags/versions starting with 1.0.
- Label: filter the resource with labels.
- Resource: filter with a resource type.
- The Destination Namespace is the Artifactory docker repo name. If the source resource filter Name set to **/**, the replication task will copy all docker images in all projects to the Artifactory docker repository.
Completing the above configuration, we can select the replication task created on the replication page, and then click the replicate button to trigger the replication task.
After the task is triggered, we can see the running status and logs of the replication task in the Executions.
Finally, we can get docker images copied in the Artifactory docker repository.