Maleesha Dinoli
Maleesha Dinoli

Reputation: 21

denied: Not Authorized Error: Process completed with exit code 1

I am getting this error while I am pushing docker image to AWS ECR repository. enter image description here

Here I mentioned my code.

My build.yml file,

name: Build Project Backend

on:
  push:
    branches: ["backend/development", "backend/master"]
  pull_request:
    branches: ["backend/development", "backend/master"]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install dependencies
        run: npm install

      - name: Lint code
        run: npm run lint

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.ACCESS_KEY }}
          aws-secret-access-key: ${{ secrets.SECRET_KEY }}
          aws-region: us-east-1


      - name: Build Docker Image
        run: docker build -t stellar-drive .

      - name: change image tag
        run: docker tag $(docker images -q stellar-drive) public.ecr.aws/o8x9n0f3/stellar_drive:2.3

      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1

      - name: push
        run: docker push public.ecr.aws/o8x9n0f3/stellar_drive

I need to resolve my issue.

Upvotes: 1

Views: 518

Answers (1)

Maleesha Dinoli
Maleesha Dinoli

Reputation: 21

Here I solved the issue.

  1. I removed my previous public repository in ECR and created new private repository with the same name.
  2. I am pushing image through github action. Cause of that I have to give permission to push images to ECR. For that created new IAM user called GitHub and EC2InstanceProfileForImageBuilderECRContainerBuilds permission has granted to that user.
  3. copied the access key and secret key and stored them in my github repo as secret keys.

For more Info - https://www.youtube.com/watch?v=m1OFz_Y9bYo

Upvotes: 1

Related Questions