首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行sls部署时,Serverless挂起。Docker命令不结束

运行sls部署时,Serverless挂起。Docker命令不结束
EN

Stack Overflow用户
提问于 2020-10-30 09:43:30
回答 1查看 1.7K关注 0票数 4

我跟踪本教程是为了用python设置无服务器的AWS。

我想使用无服务器的lambda运行这个简单的httprequest函数(驻留在httprequest.py中):

代码语言:javascript
复制
import requests

def handler(event, context):
    r = requests.get("https://news.ycombinator.com/news")
    return {"content": r.text}

以下是我的serveless.yaml:

代码语言:javascript
复制
service: serverlessProj
frameworkVersion: '2'

provider:
  name: aws
  runtime: python3.8

functions:
  hello:
    handler: hello.handler
  httprequest:
    handler: httprequest.handler

plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
    dockerizePip: true

现在,如您所见,自定义部分告诉无服务器的Python -requirements插件在Docker容器中编译Python包。它应该安装在requirements.txt中的插件。这是requirements.txt的内容:

代码语言:javascript
复制
requests

当运行sls deploy时,这是控制台输出:

代码语言:javascript
复制
Serverless: Generated requirements from /Users/user/Desktop/ShoeSwiper/Serverless/requirements.txt in /Users/user/Desktop/ShoeSwiper/Serverless/.serverless/requirements.txt...
Serverless: Installing requirements from /Users/user/Library/Caches/serverless-python-requirements/007/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.8
Serverless: Using download cache directory /Users/user/Library/Caches/serverless-python-requirements/downloadCacheslspyc
Serverless: Running docker run --rm -v /Users/user/Library/Caches/serverless-python-requirements/007\:/var/task\:z -v /Users/user/Library/Caches/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z -u 0 lambci/lambda\:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache...

然后它就被卡住了。知道是怎么回事吗。我是不是遗漏了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-30 11:30:17

好吧,结果一切都正常。命令没有挂起,只是花了很多时间。耐心是关键。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64605946

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档