我正在尝试使用 AWS ECS 和 docker 设置 CI。我使用 Codeship 作为 CI 工具,但这并不重要。
我在 shell 脚本中执行以下步骤:
- 使用我的 Dockerfile 构建镜像,
- 将镜像推送到ECS存储库,
- 将task-definition.json推送到ECS
aws ecs register-task-definition --family postgraphile --cli-input-json file:///deploy/ecs-task-def.json --region us-east-2
- 运行ECS任务
aws ecs run-task --task-definition postgraphile --cluster testcluster --region us-east-2
Shell 脚本成功运行,但是在尝试运行 ECS 任务后,我在输出中看到错误:
{
"tasks": [],
"failures": [
{
"arn": "arn:aws:ecs:us-east-2:99999999999:container-instance/050ab165-7669-45d5-8be7-d990cf4fff42",
"reason": "RESOURCE:MEMORY"
}
]
}
my ecs-task-def.json
:
{
"containerDefinitions": [
{
"name": "postgraphile-container",
"image": "999999999999.dkr.ecr.us-east-2.amazonaws.com/test-repository",
"memory": 500,
"essential": true,
"portMappings": [
{
"hostPort": 5000,
"containerPort": 5000
}
]
}
],
"volumes": [],
"memory": "900",
"cpu": "128",
"placementConstraints": [],
"family": "postgraphile",
"taskRoleArn": ""
}
我想我已经检查了所有内存限制..我错过了什么吗?
更新:
在 ec2 实例重新启动几次后,我终于可以毫无错误地运行 ecs 任务。运行任务多次后,返回错误