I'm using the Atlassian pipeline to build and push the docker image to AWS ECR but build is getting tear down with following message.
INFO: Executing the aws-ecr-push-image pipe...
INFO: Found credentials in environment variables.
INFO: Successfully logged in to https://XXXXXXX.dkr.ecr.us-east-1.amazonaws.com
✖ Image not found: 404 Client Error: Not Found ("no such image: image-test: No such image: image-test:latest")
Here is my bitbucket-pipelines.yml code:
- step:
name: docker build running
services:
- docker
script:
- docker build -t image-test .
artifacts:
- Image_Test.zip
- step:
name: Updating docker image
script:
- pipe: atlassian/aws-ecr-push-image:1.0.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: image-test
TAGS: '${BITBUCKET_TAG} latest'
I confirm that this image exists in my ECR repositories.
Docker images do not persist between pipeline steps. You have to build and push the image in the same step, for example:
- step:
name: Updating docker image
script:
- docker build -t image-test .
- pipe: atlassian/aws-ecr-push-image:1.0.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: image-test
TAGS: '${BITBUCKET_TAG} latest'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With