亚马逊 ECS "the referenced cluster was inactive"

Amazon ECS "the referenced cluster was inactive"

我按照步骤在 Ubuntu 16 上安装了 ECS 客户端,但是当我尝试 运行 ECS 容器代理时,它不断重启,当我查看日志时

2016-12-07T06:01:39Z [INFO] Starting Agent: Amazon ECS Agent - v1.13.1 (efe53c6)
2016-12-07T06:01:39Z [INFO] Loading configuration
2016-12-07T06:01:39Z [INFO] Checkpointing is enabled. Attempting to load state
2016-12-07T06:01:39Z [INFO] Loading state! module="statemanager"
2016-12-07T06:01:39Z [INFO] Event stream ContainerChange start listening...
2016-12-07T06:01:39Z [INFO] Detected Docker versions [1.17 1.18 1.19 1.20 1.21 1.22 1.23]
2016-12-07T06:01:39Z [INFO] Registering Instance with ECS
2016-12-07T06:01:39Z [ERROR] Could not register module="api client" err="ClientException: The referenced cluster was inactive.
    status code: 400, request id: 9eaa4124-bc42-11e6-9cf1-7559dea2bdf8"
2016-12-07T06:01:39Z [ERROR] Error registering: ClientException: The referenced cluster was inactive.
    status code: 400, request id: 9eaa4124-bc42-11e6-9cf1-7559dea2bdf8

我没有在 google 上找到此错误的参考,我想知道出了什么问题...

我是否需要在 ECS 仪表板上创建集群名称? 我已将容器角色附加到我的 EC2 实例,这允许创建集群,所以我认为问题不在于此...

我的docker运行配置

sudo docker run --name ecs-agent \
--detach=true \
--restart=on-failure:10 \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--volume=/var/log/ecs/:/log \
--volume=/var/lib/ecs/data:/data \
--net=host \
--env=ECS_LOGFILE=/var/log/ecs-agent.log \
--env=ECS_LOGLEVEL=info \
--env=ECS_DATADIR=/data \
--env=ECS_CLUSTER=my-cluster \
--env=ECS_ENABLE_TASK_IAM_ROLE=true \
--env=ECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST=true \
amazon/amazon-ecs-agent:latest

需要调用aws ecs create-cluster --region $REGION --cluster my-cluster,通过SDK调用CreateClusterAPI,或者在控制台创建。 ECS 代理只会自动创建一个名为 default 的集群,并且仅在 ECS_CLUSTER 未指定时才会自动创建。