英文:
Invalid entrypoint with aws-lambda-runtime-interface-emulator (RIE) with custom Docker image
问题
我正在尝试在以下的ML AWS示例上运行AWS Lambda运行时接口仿真器 (RIE),但我遇到了一个无效的入口点问题。
我的步骤如下:
- 构建镜像
docker build -t sentiment:latest .
- 运行镜像
运行镜像:
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:
- build image
docker build -t sentiment:latest .
- 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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论