aws / aws/aws-lambda-base-images
Impossible to RUN LAMBDA images when Python <3.7
- Dominant language
- No language data
- Stars
- 777
- Forks
- 118
- PR merge metrics
- No merged PRs in 30d
Description
This it has been partially discussed also in another issue, see link at bottom of the message. But I think this is capturing a wider problem I am finding with the base images
I have stripped down my docker file and my code, so that they do not contains any dependencies or anything particular. This following the very basic example in here
https://docs.aws.amazon.com/lambda/latest/dg/python-image.html
https://docs.aws.amazon.com/lambda/latest/dg/images-test.html#images-test-AWSbase
Docker files is this one
```
FROM public.ecr.aws/lambda/python:3.7
COPY app/app.py "${LAMBDA_TASK_ROOT}/"
CMD [ "app.handler" ]
```
Assuming your code is in a subfolder called _'app'_ and the filename is _app.py_
```
def handler(event, context):
print("Some Interesting Printing")
return False
if __name__ == "__main__":
output = handler(False, False)
print(output)
```
Now, you can build the image (lets call it mylambda)
`docker build -t mylambda:latest .`
If you interactively use the container as below
`docker run -it --rm --entrypoint /bin/bash --name testlambda mylambda:latest
`
You can run your app.py script with no issues.
However, if you deploy the image in Lambda itself or run locally as in the example here https://docs.aws.amazon.com/lambda/latest/dg/images-test.html#images-test-AWSbase
`docker run -p 9000:8080 mylambda:latest `
and then curl some message
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
The results I am getting is a glibc compatibility as shown below. Note that this does not happen if in the Docker file the 3.8 image is used `FROM public.ecr.aws/lambda/python:3.8`

For some compatibility issues, I need to build my app with python 3.7
**Previous issue**
https://github.com/aws/aws-lambda-base-images/issues/23
Contributor guide
Assessment
This issue has not been assessed yet.