如何使用Fargate在AWS ECS的正在运行的容器中运行命令 [英] How can I run commands in a running container in AWS ECS using Fargate

查看:260
本文介绍了如何使用Fargate在AWS ECS的正在运行的容器中运行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我正在使用EC2在AWS ECS中运行容器,那么我可以访问正在运行的容器并执行任何命令.

If I am running container in AWS ECS using EC2, then I can access running container and execute any command.

即. docker exec -it <containerid> <command>

如何使用Fargate在运行中的容器中运行命令或访问AWS ECS中的容器?

How can I run commands in the running container or access container in AWS ECS using Fargate?

推荐答案

使用Fargate,您将无法访问基础架构,因此docker exec似乎不太可能.文档未明确提及,但在深层潜水中已提及进入Amazon的AWS Fargate演示文稿,幻灯片19中对此进行了提及:

With Fargate you don't get access to the underlying infrastructure so docker exec doesn't seem possible. The documentation doesn't mention this explicitly but it's mentioned in this Deep Dive into AWS Fargate presentation by Amazon where this is mentioned on slide 19:

一些警告:无法执行到容器中或访问底层 主持人(这也是一件好事)

Some caveats: can’t exec into the container, or access the underlying host (this is also a good thing)

关于ECS中公开问题的一些讨论. CLI github项目.

There's also some discussion about it on this open issue in ECS CLI github project.

您可以尝试在容器中运行SSH服务器以获取访问权限,但我没有尝试过它,也没有遇到任何这样做的人.这似乎也不是一个好方法,所以您在那受限.

You could try to run an SSH server inside a container to get access but I haven't tried it or come across anyone doing this. It also doesn't seem like a good approach so you are limited there.

这篇关于如何使用Fargate在AWS ECS的正在运行的容器中运行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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