简体   繁体   English

在无AWS Lambda服务器上运行dockerized函数

[英]Running dockerized functions on AWS lambda serverless

I was wondering whether you can use docker when creating a function for serverless computing ? 我想知道在创建无服务器计算功能时是否可以使用docker?


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? 您如何在AWS-Lambda上下文中应用这些问题? 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. 据我们所知,当您运行lambda函数时,它已经在容器中运行-这是AWS对其进行工程设计的方式(不确定他们是否已正式记录此文件),所以我猜是不会的,您可以' t将docker容器拉入lambda函数。

However, if what you want to do is run docker containers in a more/less serverless way, check out aws fargate: 但是,如果您想要做的是以一种或多或少的无服务器方式运行docker容器,请查看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. AWS Fargate是一项适用于Amazon ECS和EKS *的技术,使您无需管理服务器或集群即可运行容器。 With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers. 使用AWS Fargate,您不再需要置备,配置和扩展虚拟机集群即可运行容器。 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. AWS Fargate使您无需与服务器或群集进行交互或考虑。 Fargate lets you focus on designing and building your applications instead of managing the infrastructure that runs them. Fargate使您可以专注于设计和构建应用程序,而不必管理运行它们的基础结构。

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

AWS Lambda runs on AmazonLinux and doesn't give root permissions to run docker. AWS Lambda在AmazonLinux上运行,并且不授予root权限运行docker。 There are also other limitations like max memory, timeout and diskspace which limit use of many docker images. 还有其他限制,例如最大内存,超时和磁盘空间,这些限制限制了许多docker映像的使用。

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. 使用udocker在Lambda上运行简单的udocker容器,在一些用例中可能非常有用。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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