I have 3 containers that are built with docker-compose and I need to push these to ECR. This is my current pipeline. How can I get this to push to ECR? I have multiple repositories, one for each container that I need to push too.
image: python:3.7.2
options:
docker: true
pipelines:
default:
- step:
script:
- pipe: atlassian/aws-ecr-push-image:1.2.0
variables:
AWS_ACCESS_KEY_ID: 'xxxx'
AWS_SECRET_ACCESS_KEY: 'xxxx'
AWS_DEFAULT_REGION: 'xxxx'
IMAGE_NAME: ""
- step:
script:
- pip install docker
- pip install docker-compose
- docker-compose build
- docker push
Hi @ragnar.callan ,
You have to specify the ECR endpoint and make sure you are able to authenticate to the ECR.
Hi, thanks for the reply. I have created my ECR endpoints. I have 3. One for each containers with different names. In my docker-compose file I labelled the images with the names of these repos. I want to push all 3 images to their respective ECR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ragnar.callan ,
Thank you for your question!
You could follow a Build Once Deploy Many approach and implement the next pipeline:
script:
# do other
- ...
- ...
# build the image
- docker-compose build
# use the pipe to push the image_1 to AWS ECR
- pipe: atlassian/aws-ecr-push-image:1.2.2
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
IMAGE_NAME: my-docker-image_1
# use the pipe to push the image_2 to AWS ECR
- pipe: atlassian/aws-ecr-push-image:1.2.2
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
IMAGE_NAME: my-docker-image_2
# use the pipe to push the image_3 to AWS ECR
- pipe: atlassian/aws-ecr-push-image:1.2.2
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
IMAGE_NAME: my-docker-image_3
Make sure that you provide right IMAGE_NAME for each push:
The name of the image to push to the ECR. The name should be the same as your ECR repository name. Remember that you don't need to add your registry URL in front of the image name, the pipe will fetch this URL from AWS and add it to the image tag for you.
Cheers,
Oleksandr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.