AWS EC2容器服务容器ID,这是什么意思?

时间:2016-08-04 03:16:04

标签: docker amazon-ec2

我有一个EC2容器服务运行一个需要两个docker容器的任务。任务运行正常,我可以看到两个容器。Please refer to the attached image。我的问题是,当我进入运行图像的EC2实例并尝试 docker images 时,我确实看到了两个容器,但它们的 CONTAINER ID 与显示的不同网页。有人可以对此有所了解。

1 个答案:

答案 0 :(得分:-1)

我正在寻找类似的东西。 在图像中,您同时指向容器ID 容器实例。 这是两件事。 ECS-Agent使用容器实例监视ECS实例中的容器。 AWS使用 AWS容器ID 代替 Docker容器ID (它们称为“ Docker ID ”)。 AWS将 AWS容器ID 称为容器ID 。 您在RDP或SSH进入实例时看到的Container ID是 Docker Container ID

如果要在两个容器ID之间建立关联,则需要使用任务ARN(显示在图像顶部)。您需要从其终端curl http://localhost:51678/v1/tasks登录到托管容器的实例。

您将获得类似于:

{ "Tasks": [ { "Arn": "arn:aws:ecs:us-east-1:<aws_account_id>:task/example5-58ff-46c9-ae05-543f8example", "DesiredStatus": "RUNNING", "KnownStatus": "RUNNING", "Family": "hello_world", "Version": "8", "Containers": [ { "DockerId": "9581a69a761a557fbfce1d0f6745e4af5b9dbfb86b6b2c5c4df156f1a5932ff1", "DockerName": "ecs-hello_world-8-mysql-fcae8ac8f9f1d89d8301", "Name": "mysql" }, { "DockerId": "bf25c5c5b2d4dba68846c7236e75b6915e1e778d31611e3c6a06831e39814a15", "DockerName": "ecs-hello_world-8-wordpress-e8bfddf9b488dff36c00", "Name": "wordpress" } ] } ] }

这基于:https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-introspection.html

根据AWS支持,如果不登录实例,当前无法执行此操作。

相关问题