Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to push an image to public ECR repository

I have tried using "atlassian/aws-ecr-push-image:1.4.2" to push an image to an existing repository in my AWS account. But unfortunately the pipe is only being able push to private repositories.

 

When i create a repository in public registry and try the same getting this following error

 

"The repository with name 'xxxxxxxx' does not exist in the registry with id 'xxxxxxxxx'"

3 answers

@siddharthjoshi@Kushan Harshana Gunasekera hi. We released new version of pipe:

  - pipe: atlassian/aws-ecr-push-image:1.5.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      IMAGE_NAME: my-docker-image
      ECR_PUBLIC: "true"
      PUBLIC_REGISTRY_ALIAS: registry-alias

with support of pushing images to ECR Public Registry.

Please, provide us feedback.

Regards, Igor.

I would love to try this out @Igor Stoyanov , Will update one of my repositories and come back to you !!!

 

Thanks,


Siddharth Joshi K

Glad to hear that @Igor Stoyanov , I'll try it out. You have been a great help, Thank you @Igor Stoyanov .

Here I've mentioned the reasons why this is happen in the Stack Overflow. Please have a look.

https://stackoverflow.com/q/69274998/6194097 

I think the "atlassian/aws-ecr-push-image:1.4.2" image doesn't support Amazon ECR Public repositories. I had the same issue, what I did was manually installed the AWS CLI version 2 in the pipeline and ran all the push commands.

That's it, but you must provide the region as us-east-1. Otherwise you'll get the same error again and again.

Yes, funnily i actually did the same :D

And even i faced this weird region (us-east-1) restrictions. But as you mentioned "atlassian/aws-ecr-push-image:1.4.2" does not seem to support public repo, as by default it's looking for a repo in the mentioned name in the private ECR and there were no parameters we could use to make it look in the public repo.

0 votes

Hi @siddharthjoshi

Thank you for your question!

Have you provided all parameters required parameters for pipe?
Do you have permissions to push images to that repository?
It would be nice if you provide us with more details to help you: pipeline configuration, logs, etc.

 

Cheers,
Oleksandr Kyrdan

Hello @Oleksandr Kyrdan 

I'm having the same issue, the thing is Amazon ECR now supports public repositories. The aws ecr command is using for the private repositories and aws ecr-public command is using for the public repositories and public repositories are only work with us-east-1 region. I've addressed this issue in the Stack Overflow, please have a look for more details.

https://stackoverflow.com/q/69274998/6194097 

Like Igor Stoyanov likes this

@Oleksandr Kyrdan What @Kushan Harshana Gunasekera mentions is correct, to push to the public repo we need to use "aws ecr-public". I have permission to push to the repo, i have already pushed few images to my private repo and also i was able to push to public repo by writing the commands manually. The code below show how i managed to push the code to public ECR


```

pipelines:
default:
  - step:
name: "Build server image"
services:
  - docker
script:
- apt-get update
- docker build -t <image-name> .
- apt-get install -y python3-pip
- pip3 install -U awscli
- aws configure set aws_access_key_id <access-key-id>
- aws configure set aws_secret_access_key <secret-key>
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- docker tag <image-name> public.ecr.aws/<repo-name>/<image-name>
- docker push public.ecr.aws/<repo-name>/<image-name>

```

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,439 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you