1

I was wondering whether you can use docker when creating a function for serverless computing ?


If so, how would it look like?


How a function handler would be specified?


Any articles or tutorials on this topic?


How could you apply these questions in AWS-Lambda context? Any specifics?


Thank you.

3
  • Why would you even need docker? Commented Mar 20, 2018 at 11:15
  • 1
    For managing dependecies. Commented Mar 20, 2018 at 11:28
  • Now you can run dockerized functions on AWS lambda. AWS has announced this feature in December 2020. Commented Mar 10, 2021 at 12:02

2 Answers 2

6

As far as we know already, when you run a lambda function it is already running in a container - that is how it is engineered at AWS (not sure if they have officially documented that), so my guess would be no, you can't pull a docker container into a lambda function.

However, if what you want to do is run docker containers in a more/less serverless way, check out aws fargate:

AWS Fargate is a technology for Amazon ECS and EKS* that allows you to run containers without having to manage servers or clusters. With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing. AWS Fargate removes the need for you to interact with or think about servers or clusters. Fargate lets you focus on designing and building your applications instead of managing the infrastructure that runs them.

https://aws.amazon.com/fargate/

Sign up to request clarification or add additional context in comments.

Comments

2

AWS Lambda runs on AmazonLinux and doesn't give root permissions to run docker. There are also other limitations like max memory, timeout and diskspace which limit use of many docker images.

But some smart minds have figured a way around. Using udocker to run simple docker containers on Lambda and can be very useful for a few use cases.

Check out: https://github.com/grycap/scar

Original reference: https://hackernoon.com/how-did-i-hack-aws-lambda-to-run-docker-containers-7184dc47c09b

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.