I ran the following in Windows 10 Powershell and it worked

docker run -v ${pwd}:/var/task "amazon/aws-sam-cli-build-image-python3.8" /bin/sh -c "pip install -r requirements.txt -t python/lib/python3.8/site-packages; exit"
Answer from Scott on Stack Overflow
🌐
DEV Community
dev.to › matthewvielkind › creating-python-aws-lambda-layers-with-docker-4376
Creating Python AWS Lambda Layers with Docker - DEV Community
May 25, 2020 - docker run -v "$PWD":/var/task "lambci/lambda:build-python3.8" /bin/sh -c "pip install -r requirements.txt -t python/lib/python3.8/site-packages/; exit" After running the command you should see the site-packages directory you created in the previous step populated with all your dependencies. If you have additional versions you want to create your Layer for make sure you substitute the occurrences of "python3.8" with the correct version you want to use.
🌐
Medium
medium.com › simform-engineering › creating-lambda-layers-made-easy-with-docker-a-developers-guide-3bcfcf32d7c3
Creating Lambda Layers Made Easy with Docker: A Developer's Guide | Simform Engineering
June 16, 2023 - The Docker image is the foundation for creating the Lambda Layer. Craft a Dockerfile that starts with a suitable base image, such as the official Python image. Install any system-level dependencies your Python packages require using the package ...
Discussions

Lambda Layers and CDK
Lambda layers is one of those features that _seem_ useful and turns out to be a nightmare in practice. Say for instance you keep your layers and functions using cloudformation. IaC, sane enough idea. layer L v1 is up. You deploy lambda A using it, all good and working. You update L so now it's v2. Next stack update for A has an issue, unrelated to the layer. Anything, random aws hiccup. The deployment rolls back. Ops, L v1 no longer exists, rollback failed, stack stuck.... Remove it all and do it again.... More on reddit.com
🌐 r/aws
21
8
May 16, 2024
What's the fastest way to package requirements for a Lambda Function?
AWS SAM with sync. https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-sync.html More on reddit.com
🌐 r/aws
60
26
January 5, 2024
Lambda with Python libraries
If you go with infrastructure as code, you can add the libraries you need as part of the CI/CD pipeline run, zipping the file at that point. This avoids polluting your Git repo with libraries. More on reddit.com
🌐 r/aws
18
9
January 23, 2023
AWS Lambda: Package as Docker container or zip+Lambda layer?
Depends on your use case (shocking, I know). If you already have a build pipeline for docker images and you aren’t worried about the whole “images take longer durrr” FUD it makes sense to build images. They are easier for developers to reason about, use, maintain, etc. That being said, there are very likely performance gains to be had in choosing zip files over images. Otherwise there wouldn’t be so many posts/comments about it. More on reddit.com
🌐 r/aws
17
7
December 1, 2022
🌐
AWS re:Post
repost.aws › knowledge-center › lambda-layer-simulated-docker
Create a Lambda layer using an ECR image and Docker | AWS re:Post
August 5, 2025 - Note: The total unzipped size of the function and all layers can't exceed the unzipped deployment package size limit of 250 MB. For information about Python version support in Lambda, see Building Lambda functions with Python. Run the following command once for each runtime that you specified in the directory structure: docker run -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.x" /bin/sh -c "pip install -r requirements.txt -t python/; exit"
🌐
Medium
medium.com › @josephcorrado7 › creating-lambda-layers-using-docker-136a37998f1f
Creating Lambda Layers using Docker | by Joseph Corrado | Medium
June 23, 2022 - As described in the README for that repo, you essentially follow these basic steps: 1. Build the docker image that is a thin layer on top of the lambda image (for the particular runtime you’re using)
🌐
RandomWits
randomwits.com › blog › lambda-layer
Creating Python AWS lambda layer with Docker
February 21, 2022 - We will create a lambda layer my-lambda-layer. ... Next, we need to list libraries that we want to include in the lambda layer. For our example, we will only add pandas to our lambda layer. ... $ mkdir -p python/lib/python3.7/site-packages $ docker run \ -v "$(pwd):/var/task" \ "lambci/lambda:build-python3.7" \ /bin/sh -c "pip install -r requirements.txt \ -t python/lib/python3.7/site-packages/; exit"
Find elsewhere
🌐
AWS
aws.amazon.com › blogs › compute › working-with-lambda-layers-and-extensions-in-container-images
Working with Lambda layers and extensions in container images | Amazon Web Services
May 24, 2021 - Create separate Dockerfiles for the function and extension. The extension Dockerfile contains the following lines. FROM python:3.8-alpine AS installer #Layer Code COPY extensionssrc /opt/ COPY extensionssrc/requirements.txt /opt/ RUN pip install -r /opt/requirements.txt -t /opt/extensions/lib FROM scratch AS base WORKDIR /opt/extensions COPY --from=installer /opt/extensions .
🌐
Nesin
nesin.io › blog › aws-lambda-layer-python-dependencies
Create AWS Lambda Layer with Python 3 dependencies using Docker
January 4, 2024 - docker run -it -v $(pwd):/var/task --platform=linux/amd64 public.ecr.aws/sam/build-python3.10:1.106.0-20240104015600 · Now you can install the dependencies that you want. In my case, I'll just install OpenAI-related sdk ... That's pretty much it. To use the dependencies for your Lambda function, you need to add the upload layer.
🌐
Ruan Bekker's Blog
ruan.dev › blog › 2022 › 05 › 27 › create-a-aws-lambda-layer-with-docker
Create a AWS Lambda Layer with Docker | Ruan Bekker's Blog
May 27, 2022 - $ docker run -v $PWD:/var/task \ lambci/lambda:build-python3.8 \ sh -c "pip install -r requirements.txt -t python/lib/python3.8/site-packages/; exit" Zip up the deployment package that we will push to AWS Lambda Layers:
🌐
My Devops Journal
skundunotes.com › 2024 › 09 › 29 › create-aws-lambda-layer-using-docker-terraform-and-github-actions
Create AWS Lambda Layer using Docker, Terraform and GitHub Actions – My Devops Journal
October 6, 2024 - I have the Terraform code in my GitHub repository: kunduso/aws-lambda-layer-terraform. You must install Docker on your local laptop and decide on the Python3 version for the AWS Lambda runtime.
🌐
Capital One
capitalone.com › tech › cloud › creating-lambda-layers
Creating Lambda Layers for Python Functions | Capital One
June 1, 2023 - docker run --name lambdalayer --rm --env HTTP_PROXY --env HTTPS_PROXY --env NO_PROXY --mount type=bind,source="$(pwd)"/my-layername,target=/var/task/lambdalayer -it aws-python3.9:local bash
🌐
Pybites
pybit.es › articles › guest-create-aws-lambda-layers
How to Create an AWS Lambda Layer For Any Python Dependency – Pybites
First, we create a new folder, for example scikit-learn-layer, and create a requirements.txt in which we put all the dependencies that we want later to be part of the Lambda layer.
🌐
GitHub
gist.github.com › Galaxy83 › 44d6018037607e746918d575700c9466
AWS Lambda Layer Python 3.9 via Docker · GitHub
AWS Lambda Layer Python 3.9 via Docker. GitHub Gist: instantly share code, notes, and snippets.
🌐
Medium
ripon-banik.medium.com › convert-your-docker-image-to-aws-lambda-layers-5c8c685800db
Convert your docker image to AWS Lambda Layers | by Ripon Banik | Medium
November 16, 2021 - A good article to work with lambda layer is below. ... Basically you put the executable in /opt/bin and library under /opt based on the language used as per below (default) which can be changed by using environment variable in Lambda. Node.js — nodejs/node_modules, nodejs/node8/node_modules (NODE_PATH) ... xray-sdk.zip └ nodejs/node_modules/aws-xray-sdk Python — python, python/lib/python3.7/site-packages (site directories)
🌐
Towards Data Science
towardsdatascience.com › home › latest › how to install python packages for aws lambda layer
How to Install Python Packages for AWS Lambda Layer | Towards Data Science
January 20, 2025 - RUN python3.7 -m pip install --upgrade pip &amp;&amp; python3.7 -m pip install virtualenv · Run the commands below to create your Dockerfile with a tag. usr> docker build -f "<filename>.Dockerfile" -t lambdalayer:latest .
🌐
DevOps.dev
blog.devops.dev › creating-aws-lambda-layers-with-ffmpeg-and-python-dependencies-e-g-4e8450483867
Creating AWS Lambda Layers with ffmpeg and Python Dependencies (e.g., requests) Using Multi-Arch Docker Builds | by Carlos Biagolini | DevOps.dev
June 13, 2025 - docker run --name lambda_layer_x86_container lambda-layer-x86 docker cp lambda_layer_x86_container:/home/layer_combined.zip ./lambda_dependencies_x86.zip docker rm -f lambda_layer_x86_container · Before uploading to Lambda, verify the zip files ...
🌐
Ian Wootten
ianwootten.co.uk › 2022 › 01 › 27 › how-to-create-aws-lambda-layers-for-python-dependencies
How to Create AWS Lambda Layers for Python Dependencies — Ian Wootten
It uses a docker image from lambci and the AWS CLI to build and publish a Lambda Layer to AWS. I’ve modified this below, and created a gist which will install from a requirements.txt file within in the same folder.
🌐
GitHub
github.com › developmentseed › geolambda
GitHub - developmentseed/geolambda: Create and deploy Geospatial AWS Lambda functions · GitHub
The Python Lambda Layer includes the libraries numpy, rasterio, GDAL, pyproj, and shapely. This is an addition to the standard GeoLambda layer; if you wish to use GeoLambda-Python, both layers must be included. ... The Docker images used to create the Lambda layer are also published to Docker Hub, and thus are also suitable for general use as a base image for geospatial applications.
Starred by 306 users
Forked by 84 users
Languages   Dockerfile 68.0% | Shell 19.5% | Python 12.5%