AWS Lambda 上的 Docker 映像在测试时执行 RUN/Entrypoint 两次
我目前正在学习和使用 Lambda 和 Docker。我目前有 Docker 文件:
FROM amazonlinux:2.0.20191016.0
RUN yum install jq -y
COPY . ./
CMD chmod 755 ./random.sh ; chmod 755 ./discord.sh
ENTRYPOINT "./random.sh"
Pretty Basic,文件 random.sh 正在通过 Discord.sh 向我的 Discord 服务器发送消息。
当我进行测试运行时,他似乎正在调用 ./random.sh 两次
2022-04-05T13:24:23.537+02:00 9
2022-04-05T13:24:23.537+02:00 https://www.oetker.at/dr-oetker-cms/oetker.de/image/image-thumb__47425__auto_23393e4cf279157878cad04620baa711/Paula-am-kochen_02.png
2022-04-05T13:24:23.971+02:00 START RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84 Version: $LATEST
2022-04-05T13:24:24.023+02:00 3
2022-04-05T13:24:24.023+02:00 https://www.sueddeutsche.de/image/sz.1.937584/640x360?v=1528418182
2022-04-05T13:24:24.726+02:00 END RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84
2022-04-05T13:24:24.726+02:00 REPORT RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84 Duration: 752.69 ms Billed Duration: 753 ms Memory Size: 128 MB Max Memory Used: 6 MB
2022-04-05T13:24:24.726+02:00 RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84 Error: Runtime exited without providing a reason Runtime.ExitError
,这是文件执行的日志,并且他似乎正在运行我的 random.sh 代码的两次,如您所见以及记录的数字和链接。
另一个问题是如何修复运行时错误。因为我的 Random.sh 总是以退出 0 执行,它应该返回成功。
我希望你能帮助我,我可以简单地通过用 python 编写并使用简单的 lamdba 函数来修复它,但我想尝试一下,通常 ENTRYPOINT 应该执行一次。我也将异步调用设置为 0,因此失败时不会重试
I am currently learning and playing around with Lambda and Docker. I have currently the Docker File:
FROM amazonlinux:2.0.20191016.0
RUN yum install jq -y
COPY . ./
CMD chmod 755 ./random.sh ; chmod 755 ./discord.sh
ENTRYPOINT "./random.sh"
Pretty Basic and the File random.sh is sending via discord.sh a message to my Discord Server.
When i am doing a Test Run its seems like he is calling the ./random.sh twice
2022-04-05T13:24:23.537+02:00 9
2022-04-05T13:24:23.537+02:00 https://www.oetker.at/dr-oetker-cms/oetker.de/image/image-thumb__47425__auto_23393e4cf279157878cad04620baa711/Paula-am-kochen_02.png
2022-04-05T13:24:23.971+02:00 START RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84 Version: $LATEST
2022-04-05T13:24:24.023+02:00 3
2022-04-05T13:24:24.023+02:00 https://www.sueddeutsche.de/image/sz.1.937584/640x360?v=1528418182
2022-04-05T13:24:24.726+02:00 END RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84
2022-04-05T13:24:24.726+02:00 REPORT RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84 Duration: 752.69 ms Billed Duration: 753 ms Memory Size: 128 MB Max Memory Used: 6 MB
2022-04-05T13:24:24.726+02:00 RequestId: c3dca9f8-1a3f-415b-8a0c-b41cd441fb84 Error: Runtime exited without providing a reason Runtime.ExitError
taht is the log of the execution of the File and it seems like he is running it twice the code of my random.sh as you can see with the numbers and the Link which get logged.
And a other Problem ist how do i fix the Runtime error. because my Random.sh is executing always with a exit 0 which should return a succesfull.
I hope you can help me out, i could fix it simply by writing in python and use simple lamdba function but i wanted to try this out and normaly the ENTRYPOINT should be exceuted once. I made Asynchronous invocation aswell to 0 so it dont retry at failed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
部署为 Image 的 lambda 预计不会作为容器化应用程序(例如 Amazon ECS)工作。
您需要安装 lambda 运行时接口客户端并将代码与其集成,查看以下指南(从替代基础镜像创建镜像)
The lambda deployed as Image isn't expected to work as containerized App (such as Amazon ECS)
You need to install lambda runtime interface client and integrate your code with it, check the following guide (Creating images from alternative base images)