'InvalidEntrypoint for AWS Lambda with python docker container

I've built an image for Lambda using public.ecr.aws/lambda/python:3.8 but always get this error.

Tried changing up the function and file names, but not getting any more details for debugging.

Also I've run the function locally and the entrypoint/cmd works.

START RequestId: cb4ba88c-c347-4e7d-b1ca-031a2e02fde4 Version: $LATEST
IMAGE   Launch error: fork/exec /lambda-entrypoint.sh: exec format error    Entrypoint: [/lambda-entrypoint.sh] Cmd: [index.lambda_handler] WorkingDir: [/var/task]IMAGE    Launch error: fork/exec /lambda-entrypoint.sh: exec format error    Entrypoint: [/lambda-entrypoint.sh] Cmd: [index.lambda_handler] WorkingDir: [/var/task]END RequestId: cb4ba88c-c347-4e7d-b1ca-031a2e02fde4
REPORT RequestId: cb4ba88c-c347-4e7d-b1ca-031a2e02fde4  Duration: 12.86 ms  Billed Duration: 13 ms  Memory Size: 128 MB Max Memory Used: 3 MB   
RequestId: cb4ba88c-c347-4e7d-b1ca-031a2e02fde4 Error: fork/exec /lambda-entrypoint.sh: exec format error
Runtime.InvalidEntrypoint


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source