- Newest
- Most votes
- Most comments
Hello.
Looking at the stackoverflow answers below there may be a possible architecture compatibility issue.
Therefore, try changing the architecture on the Lambda side or specifying the architecture when running "docker build".
Also, check if any other error logs are output.
I think there are other messages output in addition to the "Runtime.InvalidEntrypoint" message.
https://stackoverflow.com/questions/71373337/invalidentrypoint-for-aws-lambda-with-python-docker-container
Hi,
Your code doesn't have ENTRYPOINT specified. I believe that is an issue.
Look at example from https://docs.aws.amazon.com/lambda/latest/dg/python-image.html#python-image-instructions:
# Define custom function directory
ARG FUNCTION_DIR="/function"
FROM python:3.12 as build-image
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Copy function code
RUN mkdir -p ${FUNCTION_DIR}
COPY . ${FUNCTION_DIR}
# Install the function's dependencies
RUN pip install \
--target ${FUNCTION_DIR} \
awslambdaric
# Use a slim version of the base Python image to reduce the final image size
FROM python:3.12-slim
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Set working directory to function root directory
WORKDIR ${FUNCTION_DIR}
# Copy in the built dependencies
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}
# Set runtime interface client as default command for the container runtime
ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ]
# Pass the name of the function handler as an argument to the runtime
CMD [ "lambda_function.handler" ]
I believe that you should start from this example, get in to work and then adapt to your use case.
The practice of using a Dockerfile using 2 images in cascade is important to have a smaller image at the end: it reduces costs and improves perfs.
Best,
Didier
Relevant content
- asked 3 months ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 5 days ago