简体   繁体   中英

Running dockerized functions on AWS lambda serverless

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.

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM