Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker pull from public.ecr.aws results in "403 Forbidden" error

I'm attempting to build a Docker image on my Mac M1 machine using the public.ecr.aws/lambda/python:3.8 image from Amazon ECR Public as the base image in my Dockerfile. However, I'm encountering the following error during the image pull process:

ERROR: failed to solve: public.ecr.aws/lambda/python:3.8: pulling from host public.ecr.aws failed with status code: 403 Forbidden

Here's the relevant portion of my Dockerfile:

FROM public.ecr.aws/lambda/python:3.8

COPY requirements.txt  .
RUN  pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"

COPY app.py ${LAMBDA_TASK_ROOT}

CMD [ "app.handler" ]

i tried all the things like running build or buildx build --platform linux/amd64 command but no luck.

i tried directly from python:slim and i got result but i want to use public ecr.

like image 713
richy Avatar asked Jan 21 '26 04:01

richy


1 Answers

I've struggled with the same issue and finished up with their documentation, which states:

If you've previously authenticated to Amazon ECR Public, if your auth token has expired you may receive an authentication error when attempting to do unauthenticated docker pulls from Amazon ECR Public. To resolve this issue, it may be necessary to run docker logout public.ecr.aws to avoid the error. This will result in an unauthenticated pull. For more information, see Authentication issues.

The long story is here.

like image 189
Andrew Pushkin Avatar answered Jan 23 '26 20:01

Andrew Pushkin