> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/artifact-registry/3.0/get-started/migrate-to-harness-artifacts/from-amazon-ecr.md).

# Migrate from Amazon ECR

Move container images from Amazon ECR to Harness Artifacts using Docker, skopeo, or crane, with a concept mapping and what to update in pipelines.

Amazon ECR is a fully managed Docker and OCI registry that is tightly integrated with the AWS ecosystem. It does its job well, but it does only one job. If your software delivery needs have grown beyond container images, or your teams are building on more than one cloud, moving to Harness Artifacts gives you multi-format support, cloud-agnostic authentication, and a registry that is part of the same platform as your CI, CD, and security tooling.

This guide maps your ECR concepts to Harness Artifacts equivalents and walks you through two migration approaches.

## Compatibility, changes, and improvements

**What stays the same**. Docker and OCI images are first-class in Harness Artifacts. Your image names, tags, and multi-architecture manifest lists all migrate without conversion. The pull commands your applications and Kubernetes workloads use change only in the registry hostname.

**What changes for your team**.

| ECR concept                                             | Harness Artifacts equivalent                     | Notes                                                                                                                           |
| ------------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| Repository (per region, per account)                    | Registry                                         | One global endpoint (no region routing)                                                                                         |
| IAM auth + `aws ecr get-login-password`                 | PAT or SAT, `docker login pkg.harness.io`        | Token does not expire after 12 hours                                                                                            |
| ECR URI: `<acct>.dkr.ecr.<region>.amazonaws.com/<repo>` | `pkg.harness.io/<ACCOUNT_ID>/<REGISTRY>/<IMAGE>` | No AWS credentials required                                                                                                     |
| Lifecycle policies                                      | Cleanup and retention rules                      | Go to [Create a cleanup rule](https://developer.harness.io/artifact-registry/3.0/lifecycle-management/create-a-cleanup-rule.md) |
| Basic scanning + Amazon Inspector                       | Built-in vulnerability scanning                  | Scanning is part of Artifacts, not a separately licensed product                                                                |
| Pull-through cache (fixed upstream list)                | Upstream proxy (any custom source)               | You can add any registry as an upstream proxy                                                                                   |
| No package policy enforcement                           | Dependency Firewall                              | OPA-based policies block packages at the upstream proxy                                                                         |
| No multi-format support                                 | 25+ package formats                              | Maven, npm, PyPI, NuGet, Go, Helm HTTP, Cargo, and more                                                                         |

**What improves**.

ECR's pull-through cache works only with a fixed set of approved upstreams: roughly ECR Public, Docker Hub, Quay, registry.k8s.io, GHCR, and a few others. You cannot add a private source or an arbitrary custom registry. Harness upstream proxies accept any reachable registry.

ECR has no equivalent to the Dependency Firewall. Packages pulled through an ECR pull-through cache have no policy gate. In Harness Artifacts, the Dependency Firewall evaluates packages against OPA policies, checking for known vulnerabilities, unwanted licences, or package age thresholds, before they are cached in your registry.

**Software Delivery Agent**. Once your images are in Harness Artifacts, the Harness Software Delivery Agent can query your registries, artifact versions, and scan results through the Artifacts REST API (the same API your pipelines use). The agent can answer questions like "what is the latest scan-clean version of this image?", surface registries that hold artifacts with open critical CVEs, or evaluate a lifecycle rule in dry-run mode, without leaving your delivery workflow. Go to [Using Artifacts with AI agents](https://developer.harness.io/artifact-registry/3.0/agents/using-ar-with-ai-agents.md) for the full picture.

## Before you begin

* Have AWS credentials with `ecr:GetAuthorizationToken` and `ecr:BatchGetImage` on the source repositories.
* Create a Harness personal access token (PAT) with push permission on the destination registries. Go to [Authentication and identity tokens](https://developer.harness.io/artifact-registry/3.0/concepts/authentication-and-identity-tokens.md).
* Create the destination registries in Harness Artifacts before migrating. Go to [Create a registry](https://developer.harness.io/artifact-registry/3.0/registries/create-a-registry.md) and select **Docker** as the type.
* Have your Harness account ID ready. It appears in the URL when you log in to Harness (`app.harness.io`).

{% hint style="info" %}
The Harness CLI migration tool (`hc registry migrate`) supports JFrog Artifactory and Nexus as source types. Amazon ECR is not a supported source type for the CLI tool. Use the Docker, skopeo, and crane approaches in this guide.
{% endhint %}

## Migration options

Three approaches cover the full range of use cases.

**Option A: Gradual cut-over with an upstream proxy**. Point a Harness upstream proxy at your ECR instance. Images that do not yet exist in Harness are fetched from ECR on first request and cached. You migrate traffic incrementally by updating pipelines one by one, with no bulk copy required. Best when you want zero downtime and a rollback path.

**Option B: Docker pull and push**. Works for any environment where Docker is installed. Best for a one-time migration of a small number of images or for testing before a full migration.

**Option C: skopeo or crane (bulk copy)**. Works without a Docker daemon. Copies multi-architecture manifest lists and all tags in one command. Best for migrating many images or automating the migration in CI.

## Option A: Gradual cut-over with an upstream proxy

Harness supports Amazon ECR as a first-class upstream proxy source type. When you configure a proxy with **AWS ECR** as the source, Harness uses the ECR authorization token automatically; you do not need to manage the 12-hour token refresh yourself.

### Step 1: Create an upstream proxy pointing at ECR

1. In the navigation menu, select **Registries**, then select **Create registry**.
2. Create a new **Docker** registry, or open an existing one.
3. In the registry's **Configuration** tab, go to **Upstream proxy** and select **Add upstream proxy**.
4. Create a new upstream proxy. Set **Source** to **AWS ECR** and enter your ECR credentials (AWS Access Key ID and Secret Access Key, or use an IAM role if your compute supports it).
5. Save and add the proxy to your registry's upstream list.

Pipelines and clients that pull through this Harness registry will transparently fetch from ECR on first request. Once an image is cached in Harness, subsequent pulls serve from Harness directly.

### Step 2: Update clients to pull from Harness

Update one pipeline or client at a time to pull from `pkg.harness.io` through the new registry. Monitor the **Packages** tab in the registry to confirm images are populating. When all pipelines have cut over and images are fully cached, you can decommission the ECR repository at your own pace.

## Option B: Docker pull and push

### Step 1: Log in to ECR

```bash
aws ecr get-login-password --region <REGION> | \
  docker login --username AWS --password-stdin \
  <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com
```

Replace `<REGION>` and `<ACCOUNT_ID>` with your AWS region and account ID.

{% hint style="warning" %}
The ECR authorization token expires after 12 hours. For long-running migration scripts, add a re-authentication step or use Option C (skopeo or crane), which can refresh credentials at each image.
{% endhint %}

### Step 2: Log in to Harness Artifacts

```bash
docker login pkg.harness.io \
  --username <HARNESS_EMAIL> \
  --password <HARNESS_PAT>
```

### Step 3: Pull, tag, and push each image

```bash
# Pull from ECR
docker pull <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com/<REPO>:<TAG>

# Tag for Harness Artifacts
docker tag \
  <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com/<REPO>:<TAG> \
  pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>/<REPO>:<TAG>

# Push to Harness Artifacts
docker push pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>/<REPO>:<TAG>
```

### Scripting for multiple images

Use the AWS CLI to list all images in a repository and loop:

```bash
REGION=us-east-1
ECR_ACCOUNT=123456789012
HAR_ACCOUNT=your-harness-account-id
ECR_REPO=my-service
HAR_REGISTRY=my-docker-registry

# get all tags
TAGS=$(aws ecr list-images \
  --repository-name "$ECR_REPO" \
  --region "$REGION" \
  --filter tagStatus=TAGGED \
  --query 'imageIds[*].imageTag' \
  --output text)

for TAG in $TAGS; do
  docker pull "${ECR_ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${ECR_REPO}:${TAG}"
  docker tag \
    "${ECR_ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${ECR_REPO}:${TAG}" \
    "pkg.harness.io/${HAR_ACCOUNT}/${HAR_REGISTRY}/${ECR_REPO}:${TAG}"
  docker push "pkg.harness.io/${HAR_ACCOUNT}/${HAR_REGISTRY}/${ECR_REPO}:${TAG}"
done
```

## Option C: skopeo or crane (bulk copy)

skopeo and crane copy images between registries without a Docker daemon. They preserve multi-architecture manifest lists (`--all`) and can be run in CI without a privileged container.

### Use skopeo

Install skopeo from your package manager or the [skopeo releases page](https://github.com/containers/skopeo/releases).

**Authenticate to both registries**:

```bash
# ECR: write the credentials to a skopeo auth file
aws ecr get-login-password --region <REGION> | \
  skopeo login --username AWS --password-stdin \
  <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com

# Harness Artifacts
skopeo login pkg.harness.io \
  --username <HARNESS_EMAIL> \
  --password <HARNESS_PAT>
```

**Copy a single image (all tags and architectures)**:

```bash
skopeo copy --all \
  docker://<ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com/<REPO>:<TAG> \
  docker://pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>/<REPO>:<TAG>
```

**Copy all tags in a repository**:

```bash
skopeo sync \
  --src docker \
  --dest docker \
  --all \
  <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com/<REPO> \
  pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>
```

### Use crane

Install crane from the [go-containerregistry releases page](https://github.com/google/go-containerregistry/releases).

**Authenticate**:

```bash
aws ecr get-login-password --region <REGION> | \
  crane auth login <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com \
  --username AWS --password-stdin

crane auth login pkg.harness.io \
  --username <HARNESS_EMAIL> \
  --password <HARNESS_PAT>
```

**Copy an image**:

```bash
crane copy \
  <ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com/<REPO>:<TAG> \
  pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>/<REPO>:<TAG>
```

**Copy all repositories in a script**:

```bash
REGION=us-east-1
ECR_ACCOUNT=123456789012
HAR_ACCOUNT=your-harness-account-id
HAR_REGISTRY=my-docker-registry

aws ecr describe-repositories \
  --region "$REGION" \
  --query 'repositories[*].repositoryName' \
  --output text | \
  tr '\t' '\n' | \
  while read REPO; do
    crane ls "${ECR_ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${REPO}" | \
      while read TAG; do
        crane copy \
          "${ECR_ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${REPO}:${TAG}" \
          "pkg.harness.io/${HAR_ACCOUNT}/${HAR_REGISTRY}/${REPO}:${TAG}"
      done
  done
```

## Verify the migration

Before switching production traffic, confirm that your images are available in Harness Artifacts:

1. In the navigation menu, select **Registries**, then select your destination Docker registry.
2. Go to the **Packages** tab and confirm the expected image names and tags are listed.
3. Pull one image from Harness to confirm it resolves and matches the original:

```bash
docker pull pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>/<REPO>:<TAG>
docker inspect pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>/<REPO>:<TAG> \
  --format '{{.RepoDigests}}'
```

Compare the digest against the source image in ECR. If images are missing, re-run the copy command with verbose logging to identify failures.

## Update your clients and pipelines

After verifying, update the registry hostname in every place your images are referenced.

**Docker clients and CI scripts**: Replace `<ACCOUNT_ID>.dkr.ecr.<REGION>.amazonaws.com` with `pkg.harness.io/<HARNESS_ACCOUNT_ID>/<REGISTRY>`. Go to [Docker client setup](https://developer.harness.io/artifact-registry/3.0/setup/docker.md) for the login and pull configuration.

**Kubernetes workloads**: Update `spec.containers[*].image` in your manifests, and update any `imagePullSecrets` to reference the Harness registry secret. Go to [Docker client setup](https://developer.harness.io/artifact-registry/3.0/setup/docker.md) for the pull secret format.

**Harness CI pipelines**: Go to [Harness CI integration](https://developer.harness.io/artifact-registry/3.0/platform-integrations/harness-ci.md) to connect a Harness Artifacts registry to your build and push steps.

**Harness CD deployments**: Go to [Harness CD integration](https://developer.harness.io/artifact-registry/3.0/platform-integrations/harness-cd.md) to update artifact sources in your services.

## Troubleshooting

<details>

<summary>ECR authorization token expired during migration</summary>

The ECR token from `aws ecr get-login-password` expires after 12 hours. For long-running migrations, run the login command again and resume. With skopeo and crane, you can wrap the copy commands in a script that re-authenticates before each batch.

</details>

<details>

<summary>Multi-architecture images are not preserved</summary>

The single-image `docker pull` + `docker push` approach pulls only the image for the local platform. Use `skopeo copy --all` or `crane copy` to copy the full manifest list and all platform variants.

</details>

<details>

<summary>Permission denied pushing to Harness Artifacts</summary>

Confirm your Harness PAT has push permission on the destination registry. Go to [RBAC and permissions](https://developer.harness.io/artifact-registry/3.0/reference/rbac-and-permissions.md) to check role assignments. The token must be scoped to the correct account, organization, and project.

</details>

<details>

<summary>Image not found when pulling from ECR</summary>

Confirm that the AWS credentials used have `ecr:BatchGetImage` and `ecr:GetDownloadUrlForLayer` permissions on the source repository. For cross-account ECR, the source account also needs a repository policy that grants access to the account or role running the migration.

</details>

<details>

<summary>Where do I find my Harness account ID?</summary>

Your account ID appears in the URL when you log in to Harness: `app.harness.io/ng/account/<ACCOUNT_ID>`. It also appears in the **Setup Client** panel: open any registry, go to the row menu, and select **Setup Client**.

</details>

For further help, contact Harness Support.

{% @harness-feedback/feedback %}
