Push an image to AWS ECR after it builds

Issue #14923 resolved
Justin Heyes-Jones
created an issue

Hi!

I'm currently evaluating replacing our companies Jenkins jobs with Atlassian Pipelines

I have been able to build my Scala code and the resulting Docker image simply enough, but once the Docker image is built I would like to push it to Amazons ECR.

Is this currently possible?

Justin

Comments (7)

  1. Matt Ryall staff

    Yes, you can push to ECR from your Pipelines build. Here's the typical pattern you follow in your script:

    eval $(aws ecr get-login --region <region>)
    docker push registry.com/user/format
    

    If you are having trouble, please raise a support ticket and one of our engineers can help you work through the issue.

  2. Justin Heyes-Jones reporter

    I got this working no problem but it's worth pointing out that although you can magically use docker using { options: docker: true } you do need to use a build image that has the aws cli built in, or is there another way to get that?

  3. Matt Ryall staff

    Unfortunately, there's no magical way at the moment to get the AWS CLI. At the moment, you can either include it in your container or use your package manager (e.g. apt-get) to install it.

    In the future, we'd like to add the AWS CLI (plus GCP/Azure) to our default build images and have a simple way to automatically install them in the build container. We don't have a specific ticket for this currently, but it's roughly planned as part of delivering #12844 and #12751.

    Out of interest - are you using a custom build image or one of our default ones?

  4. Justin Heyes-Jones reporter

    I was using hseeberger/scala-sbt for Scala and SBT so I just added aws cli to that and made a custom image. Easy enough, but it would be cool to make it easier to connect to the major cloud providers registries because they seem to change little things now and then and it's been a pain point for us to keep up.

  5. Log in to comment