So i’m having a problem pushing an image to an AWS ECR under my account.
I am using aws-ecr orb version@6.1.0.
As per job
definition in official documentation everything goes fine and it logs into my AWS account as well, but for some reason it fails to push the image to AWS ECR and the error I get is:
#!/bin/bash -eo pipefail
docker push $AWS_ACCOUNT_ID/myrepo:latest
The push refers to repository [docker.io/<HIDING_ACCOUNT_ID>/myrepo]
denied: requested access to the resource is denied
Exited with code 1
Here is my config.yml:
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr@6.1.0
# aws-ecs: circleci/aws-ecs@0.0.8
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:12.2.0
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
workflows:
version: 2.1
build-and-deploy:
jobs:
- build
- aws-ecr/build-and-push-image:
requires:
- build
account-url: AWS_ACCOUNT_ID
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
create-repo: true
repo: myrepo
dockerfile: "Dockerfile"
region: AWS_REGION
It seems that instead of pushing the image to aws_account_id.dkr.ecr.region.amazonaws.com/myrepo
, it tries to push to docker.io/<HIDING_ACCOUNT_ID>/myrepo
and obviously fails.
What can be done to solve this issue?