Skip to main content

Use images from multiple ACRs

The harness does not have its own built-in container image registry to store and host container images. Instead, Harness relies on external container image registries, such as Docker Hub, Amazon Elastic Container Registry (ECR), Google Container Registry (GCR), or Azure Container Registry (ACR), to pull images during the deployment process.

When deploying applications using Harness, you specify the image repository and tag for each service or microservice you want to deploy. Then Harness pulls the specified images from your container image registry (e.g., Docker Hub, ECR, GCR, ACR) and deploys them to your target environment. For more information and a list of supported container registries, go to Build and push artifacts and images.

Problem

Harness supports pushing and pulling images from ACR. If you have multiple ACRs, you might need to pull images from different ACRs in the same pipeline.

Solution

If you have multiple ACRs, the solution depends on the images you are pulling.

Pull Harness-required images from a private registry

When you run a Harness CI pipeline, Harness pulls required CI images from the public registry where they are stored. If desired, you can pull Harness images from a private registry. This involves replicating the images into your own private registry, and then modifying the built-in Harness Docker connector (ID: harnessImage) to pull from your private registry.

Pull your own images from multiple ACRs

To pull your own images from multiple ACRs, you can create one or more Microsoft Azure connectors or Docker connectors for your ACRs.

If your ACRs are under the same app registration or Azure subscription, then you can use one connector. If you need to pull images from ACRs in multiple app registrations or subscriptions, you need to create a separate connector for each app/subscription. For more information, go to Add a Microsoft Azure connector - Configure credentials.

To pull images, use your connectors in Run steps or other steps where you need to pull images. If you created multiple connectors, you need to create a separate step for each connector. To optimize your pipeline, you can use parallelism and looping strategies to execute multiple steps at once or repeat over the same commands with different connectors. You can also execute matrix steps in parallel for more time savings.

Push images to multiple ACRs

To push your own images to multiple ACRs, you can create one or more Azure or Docker connectors for your ACRs.

If your ACRs are under the same app registration or Azure subscription, then you can use one connector. If you need to push images to ACRs in multiple app registrations or subscriptions, you need to create a separate connector for each app/subscription. For more information, go to Add a Microsoft Azure connector - Configure credentials.