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.
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.awsto avoid the error. This will result in an unauthenticated pull. For more information, see Authentication issues.
The long story is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With