AwsCli Cannot Find Credentials After Switching Executors

AwsCli already setup but to run docker push i need to be inside the ubuntu executor. But after switching, it can no longer find the credentials.

44df0d00: Preparing 
65048541: Preparing 
74f17c61: Preparing 
73770570: Preparing 
7bbbdc3d: Preparing 
b20a51e8: Preparing 
3ac1f7e9: Preparing 
89c39beb: Preparing 
denied: Not Authorized

Here’s what my yml looks like. What should i do?

version: 2.1
orbs:
  aws-cli: circleci/aws-cli@3.1
executors:
  my-executor:
    machine:
      image: ubuntu-2204:2022.04.1
jobs:
  build-push-image:
    executor: my-executor
    steps:
      - checkout
      - run:
          name: Docker-authenticate
          command: sudo docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
      - run:
          name: Docker-build
          command: sudo docker build -t $DOCKER_IMAGE_NAME:v1.0.<<pipeline.number>> .
      - run:
          name: Docker-push
          command: sudo docker push $DOCKER_IMAGE_NAME:v1.0.<<pipeline.number>>
      - run:
          name: Docker-Aws-Tag
          command: sudo docker tag $DOCKER_IMAGE_NAME:v1.0.<<pipeline.number>> public.ecr.aws/g2p5t3u7/hello-hi-api:v1.0.<<pipeline.number>>
      - run:
          name: Docker-Aws-Push
          command: sudo docker push public.ecr.aws/g2p5t3u7/hello-hi-api:v1.0.<<pipeline.number>>
  awscli-setup-job:
    executor: aws-cli/default
    steps:
      - checkout
      - aws-cli/setup:
          profile-name: superhero-ecr
          aws-access-key-id: AWS_ECR_ACCESS_KEY
          aws-secret-access-key: AWS_ECR_SECRET_KEY
      - run: 
          name: AwsEcr
          command: aws ecr-public get-login-password --profile superhero-ecr --region us-east-1
workflows:
  buildpush-image:
    jobs:
      - awscli-setup-job
      - build-push-image:
          requires:
            - awscli-setup-job

plz help

It is hard to tell from your script as you do not provide the values of the environment variables, but I guess one place to look is $DOCKER_IMAGE_NAME

You are using this for Docker-push stage, but if it contains just the name you wish to give the image it is not enough as the structure of an assigned name would be more like

                      $DOCKER_USERNAME/$PROJECT_IMAGE_NAME:<other details>