Can't deploy container image to lambda function

I try to deploy container image to lambda function, but this error message appear

The image manifest or layer media type for the source image <image_source> is not supported.

here is my Dockerfile, i believe i have use the proper setup

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

# Install dependencies
COPY requirements.txt ./
RUN pip install -r requirements.txt

# Copy function code
COPY app/* ./

# Set the CMD to your handler
CMD [ "lambda_function.lambda_handler" ]

Solution 1:

Try by specifying the target platform of the image you build as amd64:

docker build --platform linux/amd64 . -t my_image.

I get the same error while trying to deploy a lambda based on an image that supports both linux/amd64 and linux/arm64/v8 (Apple Silicon) architectures.