aws-lambda-runtime-interface-emulator (RIE) 使用自定义 Docker 镜像的无效入口点

huangapple go评论72阅读模式
英文:

Invalid entrypoint with aws-lambda-runtime-interface-emulator (RIE) with custom Docker image

问题

我正在尝试在以下的ML AWS示例上运行AWS Lambda运行时接口仿真器 (RIE),但我遇到了一个无效的入口点问题。

我的步骤如下:

  1. 构建镜像 docker build -t sentiment:latest .
  2. 运行镜像

运行镜像:

docker run -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 --platform linux/amd64 \
    --entrypoint /aws-lambda/aws-lambda-rie \
    sentiment:latest \
        /usr/local/bin/python -m awslambdaric sentiment.handler

在尝试对镜像发出curl请求 curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}' 后,我收到以下错误:

13 Jul 2023 14:36:13,753 [INFO] (rapid) extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory
13 Jul 2023 14:36:13,753 [INFO] (rapid) Configuring and starting Operator Domain
13 Jul 2023 14:36:13,753 [INFO] (rapid) Starting runtime domain
13 Jul 2023 14:36:13,753 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory
13 Jul 2023 14:36:13,753 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false
13 Jul 2023 14:36:13,754 [WARNING] (rapid) First fatal error stored in appctx: Runtime.InvalidEntrypoint
13 Jul 2023 14:36:13,754 [ERROR] (rapid) Init failed InvokeID= error=fork/exec /usr/local/bin/python: no such file or directory
13 Jul 2023 14:36:13,755 [INFO] (rapid) Starting runtime domain
13 Jul 2023 14:36:13,756 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory
13 Jul 2023 14:36:13,756 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false
13 Jul 2023 14:36:13,756 [WARNING] (rapid) Omitting fatal error Runtime.InvalidEntrypoint: Runtime.InvalidEntrypoint already stored
英文:

I am trying to run the AWS lambda runtime interface emulator (RIE) on the following ML AWS sample

I am having trouble with an invalid entrypoint

My steps are:

  1. build image docker build -t sentiment:latest .
  2. run image

Run image:

docker run -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 --platform linux/amd64 \
    --entrypoint /aws-lambda/aws-lambda-rie \
    sentiment:latest \
        /usr/local/bin/python -m awslambdaric sentiment.handler

I get the following error after trying to fire a curl request curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}' at the image:

13 Jul 2023 14:36:13,753 [INFO] (rapid) extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory
13 Jul 2023 14:36:13,753 [INFO] (rapid) Configuring and starting Operator Domain
13 Jul 2023 14:36:13,753 [INFO] (rapid) Starting runtime domain
13 Jul 2023 14:36:13,753 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory
13 Jul 2023 14:36:13,753 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false
13 Jul 2023 14:36:13,754 [WARNING] (rapid) First fatal error stored in appctx: Runtime.InvalidEntrypoint
13 Jul 2023 14:36:13,754 [ERROR] (rapid) Init failed InvokeID= error=fork/exec /usr/local/bin/python: no such file or directory
13 Jul 2023 14:36:13,755 [INFO] (rapid) Starting runtime domain
13 Jul 2023 14:36:13,756 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory
13 Jul 2023 14:36:13,756 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false
13 Jul 2023 14:36:13,756 [WARNING] (rapid) Omitting fatal error Runtime.InvalidEntrypoint: Runtime.InvalidEntrypoint already stored

答案1

得分: 0

问题在于容器中没有/usr/local/bin/python,而是使用python3。在运行命令中使用python3解决了这个问题。

英文:

The problem was there is no /usr/local/bin/python in the container it uses python3 using python3 in the run command fixed the problem

huangapple
  • 本文由 发表于 2023年7月13日 22:38:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76680621.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定