运行脚本时,ECS Fargate 中的 Docker 容器以代码 0 退出.无法运行容器以访问/bin/sh [英] Docker container in ECS Fargate exits with code 0 when running script. Unable to run container to get to /bin/sh

查看:29
本文介绍了运行脚本时,ECS Fargate 中的 Docker 容器以代码 0 退出.无法运行容器以访问/bin/sh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ECS 集群,它使用托管在 AWS ECR 中的映像.dockerfile 正在其入口点属性中执行脚本.我的集群能够启动实例,但随后进入停止状态.它给我的唯一错误如下:

I have an ECS Cluster that is using an image hosted in AWS ECR. The dockerfile is executing a script in it's entrypoint attribute. My cluster is able to spin up instances but then goes into a stopped state. The only error it is giving me is as follows:

Exit Code   0
Entry point ["/tmp/init.sh"]

给我的唯一信息是容器停止的原因:

The only information given to me is the reason the container stopped:

Stopped reason Essential container in task exited

有关如何解决此问题的任何建议都会有所帮助.

Any advice on how I can fix this would be helpful.

我尝试使用以下方法在本地运行容器:docker run -it application/bin/sh

I tried running the container locally using the following: docker run -it application /bin/sh

由于某种原因运行容器,我无法使用/bin/sh.

For some reason running the container, I am unable to get to in using /bin/sh.

任何建议将不胜感激.

推荐答案

init.sh 脚本有什么作用?该消息不一定是坏消息.这可能只是意味着您的脚本已完成并且没有后台进程启动,因此您的容器正在退出.

What does the init.sh script do? That message isn't bad necessarily. It may just mean that your script has completed and no background process has started so your container is exiting.

您可以在本地运行容器并获得一个 shell(就像您所做的那样)并从那里手动启动脚本,或者您可以在没有 /bin/sh 的情况下运行容器并让脚本执行以查看发生什么了.如果脚本也在本地退出,那么这似乎是正确的行为,您可以在本地调试任何需要调试的内容.

You could run the container locally gaining a shell (as you did) and launch the script manually from there or you could just run the container without /bin/sh and let the script execute to see what happens. If the script exits locally as well then that seems to be the proper behavior and anything you'd need to debug you can debug locally.

这篇关于运行脚本时,ECS Fargate 中的 Docker 容器以代码 0 退出.无法运行容器以访问/bin/sh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆