A mock AWS Lambda python3.6 runtime environment that eases lambda function development
459
This is a mock AWS Lambda python 3.6 runtime environment that you can use to develop python lambda functions locally. The image is based on the on the python 3.6 environment from lambci/docker-lambdaā , but enhances that environment with extra features to make local development easier.
Since this image is built on thelambci/docker-lambda:python3.6, it has
similar features as that image. It a sandboxed environment that mostly replicates
the live AWS Lambda environment ā including installed software and libraries,
file structure and permissions, environment variables, context objects and
behaviors ā even the user and running process are the same.
boto3 and its dependencies installed into /var/runtime. This is
not necessarily true in the AWS environment.caltechads/docker-python-lambda:python3.6: the latest version of the imagecaltechads/docker-python-lambda:python3.6-build5: the specific tag of latest version of the
image. Use this is you want to pin to a specific build of
`caltechads/docker-lambda-python:python:3.6Here are the differences between this python 3.6 environment and the one from lambci/docker-lambdaā :
You can run your Lambdas from local directories using the -v arg with docker run
ā logging goes to stderr and the callback result goes to stdout.
You mount your (unzipped) lambda code at /var/task and any (unzipped) layer
code at /opt, and most runtimes take two arguments ā the first for the handler
and the second for the event, ie:
# With a lambda module named my_module.py containing a handler function
docker run --rm -v "$PWD":/var/task lambci/lambda:python3.6 my_module.handler
# With a lambda module named my_module.py containing a handler function and a layer
# in $PWD/layer
docker run --rm -b "$PWD"/layer:/opt -v "$PWD":/var/task lambci/lambda:python3.6 my_module.handler
To make docker-lambda-python itself log to stderr so that you can see what it
is doing, define the DOCKER_LAMBDA_PYTHON_DEBUG environment variable to be "True":
# With a lambda module named my_module.py containing a handler function
docker run --rm -e "DOCKER_LAMBDA_PYTHON_DEBUG=True" -v "$PWD":/var/task lambci/lambda:python3.6 my_module.handler
Content type
Image
Digest
Size
815.9 MB
Last updated
over 5 years ago
docker pull caltechads/docker-lambda-python:python3.6