I am running a service in AWS ECS. From inside the container, I am trying to build and push a new image (using Kaniko) to ECR but I am facing the following error every time:
error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "${account_id}.dkr.ecr.${region}.amazonaws.com/${repo_name}:${tag_name}”: POST https://${account_id}.dkr.ecr.${region}.amazonaws.com/${location}: unexpected status code 401 Unauthorized: Not Authorized
Here is the Shell Script I am using for building the image:
aws ecr get-login-password --region ${region}
/kaniko/executor --dockerfile ${docker_file_path}
--destination ${repo_tag_name}
--build-arg account_id=${account}
--build-arg env=${exec_stage}
--build-arg python_version=${python_version}
--build-arg model_class=${model_class}
--build-arg model_pickle=${model_pickle}
--build-arg model_attributes=${model_attributes}
--build-arg requirements=${requirements}
--build-arg predictor=${predictor}
--build-arg http_proxy=${http_proxy}
--build-arg https_proxy=${https_proxy}
--build-arg region=${region}
My service is up and running and it executes all the tasks perfectly such as consuming messages from the message broker, downloading artefacts from s3 bucket. But whenever I am trying to push the image built by Kaniko to ECR, it fails.
I’m expecting that the image should be pushed to ECR without having any docker dependency
creator is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.