Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image not found: 404 Client Error: Not Found: aws-ecr-push-image atlassian pipeline

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.

like image 983
Saurabh Sharma Avatar asked Jan 21 '20 18:01

Saurabh Sharma


1 Answers

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'
like image 77
Alexander Zhukov Avatar answered Nov 01 '22 05:11

Alexander Zhukov