无法启动 Elastic Beanstalk MultiContainer 实例

man*_*ish 5 docker amazon-elastic-beanstalk

我的 Dockerrun.aws.json

{
  "AWSEBDockerrunVersion": 2,
  "Authintication": {
    "Bucket": "abc",
    "key": "config.json"
  },
  "containerDefinitions": [
    {
      "name": "data",
      "image": "id.dkr.ecr.eu-west-2.amazonaws.com/dbdata:latest",
      "essential": false,
      "memory": 512,
      "command" : [
       "/bin/bash"
      ]
    },
    {
      "name": "codebase",
      "image": "id.dkr.ecr.eu-west-2.amazonaws.com/codebase:latest",
      "essential": false,
      "memory": 512,
      "command" : [
       "/bin/bash"
      ]
    },
    {
      "name": "postgres",
      "image": "id.dkr.ecr.eu-west-2.amazonaws.com/postgres:latest",
      "essential": true,
      "memory": 1024,
      "volumesFrom": [
        {
          "sourceContainer": "data"
        }
      ],
      "portMappings": [
        {
          "hostPort": 5432,
          "containerPort": 5432
        }
      ],
      "links": [
        "data"
      ]
    },
    {
      "name": "boxer-api",
      "image": "id.dkr.ecr.eu-west-2.amazonaws.com/boxer-api:latest",
      "essential": true,
      "memory": 1024,
      "volumesFrom": [
        {
          "sourceContainer": "codebase"
        }
      ],
      "portMappings": [
        {
          "hostPort": 8080,
          "containerPort": 8080
        }
      ],
      "links": [
        "codebase",
        "postgres",
        "data"
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

错误 eb-activity.log

[2017-04-05T08:29:00.728Z] INFO [3738] - [应用部署优先

Release@1/StartupStage1/AppDeployEnactHook/02update-credentials.sh] :

开始活动... [2017-04-05T08:29:00.913Z] INFO [3738] -

【应用部署优先

Release@1/StartupStage1/AppDeployEnactHook/02update-credentials.sh] :

完成活动。[2017-04-05T08:29:00.914Z] INFO [3738] - [应用部署首次发布@1/StartupStage1/AppDeployEnactHook/03start-task.sh]:开始活动... [2017-04-05T08:30: 37.520Z] INFO [3738] - [应用程序部署首次发布@1/StartupStage1/AppDeployEnactHook/03start-task.sh]:活动执行失败,因为:+。/opt/elasticbeanstalk/hooks/common.sh
+ RETRY=0 + initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20170405-3738-17c2sc0 initctl: Job

启动失败 + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']' + warn '启动 ECS 任务失败,正在重试...' + echo '启动 ECS 任务失败,重试...' 无法启动 ECS 任务,正在重试... + eventHelper.py --msg '无法启动 ECS 任务,正在重试...' --severity WARN + RETRY=1 + sleep 3 + '[' 1 -gt 1 ']' + initctl 启动 eb-ecs

EB_EVENT_FILE=/tmp/eventsfile20170405-3738-17c2sc0 initctl: Job failed to start + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']' + warn '未能启动 ECS 任务,重试...' + echo '启动ECS任务失败,正在重试...' 启动ECS任务失败,正在重试... + eventHelper.py --msg '启动ECS任务失败,正在重试...' --severity WARN + RETRY=2 + sleep 3 + '[' 2 -gt 1 ']' + error_exit '重试 2 次后未能启动 ECS 任务。1 + 错误“重试 2 次后无法启动 ECS 任务。” + echo '重试 2 次后无法启动 ECS 任务。' 未能启动

重试 2 次后的 ECS 任务。+ eventHelper.py --msg '重试 2 次后无法启动 ECS 任务。' --severity ERROR + exit 1 (ElasticBeanstalk::ExternalInvocationError) 由:+ 引起。/opt/elasticbeanstalk/hooks/common.sh + RETRY=0 + initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20170405-3738-17c2sc0 initctl: 作业无法启动 + '[' -f /etc/elasticbeanstalk/.eb- ecs-start-no-retry ']' + warn '启动 ECS 任务失败,正在重试...' + echo '启动 ECS 任务失败,正在重试...' 启动 ECS 任务失败,正在重试... + eventHelper .py --msg '无法启动 ECS 任务,正在重试...' --severity WARN + RETRY=1 + sleep 3 + '[' 1 -gt 1 ']' + initctl start eb-ecs

EB_EVENT_FILE=/tmp/eventsfile20170405-3738-17c2sc0 initctl: Job failed to start + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']' + warn '未能启动 ECS 任务,重试...' + echo '启动ECS任务失败,正在重试...' 启动ECS任务失败,正在重试... + eventHelper.py --msg '启动ECS任务失败,正在重试...' --severity WARN + RETRY=2 + sleep 3 + '[' 2 -gt 1 ']' + error_exit '重试 2 次后未能启动 ECS 任务。1 + 错误“重试 2 次后无法启动 ECS 任务。” + echo '重试 2 次后无法启动 ECS 任务。' 未能启动

重试 2 次后的 ECS 任务。+ eventHelper.py --msg '重试 2 次后无法启动 ECS 任务。' --severity ERROR + exit 1 (Executor::NonZeroExitStatus)

ECS 代理日志:

2017-04-05T09:13:11Z [信息] 保存状态!模块=“状态管理器”

2017-04-05T09:13:11Z [INFO] 完成拉取容器 postgres(id.dkr.ecr.eu-west-2.amazonaws.com/postgres:latest) (PULLED->RUNNING)。锁定获取和拉取耗时 233 纳秒。

2017-04-05T09:13:11Z [关键] 任务状态不佳;它不是稳态但没有容器想要转换 module="TaskEngine" task="awseb-ebsBoxer-env-y9jmnnjnnm:3 arn:aws:ecs:eu-west-2:443611395156:task/f510bd3f-5b97-4fbe-af6c- 61e037b08a29,状态:(NONE->RUNNING)容器:[代码库(STOPPED->RUNNING),postgres(PULLED->RUNNING),数据(STOPPED->RUNNING),]”

2017-04-05T09:13:11Z [CRITICAL] 将任务移动到由于状态错误模块 =“TaskEngine” task="awseb-ebsBoxer-env-y9jmnnjnnm:3 arn:aws:ecs:eu-west-2:443611395156 :task/f510bd3f-5b97-4fbe-af6c-61e037b08a29, 状态: (NONE->RUNNING) 容器: [codebase (STOPPED->RUNNING),postgres (PULLEDRUNNING),data(STOPPED->RUNNING),]-0401 -05T09:13:11Z [INFO] 任务更改事件模块="TaskEngine"event="{TaskArn:arn:aws:ecs:eu-west-2:443611395156:task/f510bd3f-5b97-4fbe-af6c-61e037b08a29 状态STOPPED 原因:Task:awseb-ebsBoxer-env-y9jmnnjnnm:3 arn:aws:ecs:eu-west-2:443611395156:task/f510bd3f-5b97-4fbe-af6c-61e037b08a29(STOPBaseContainer:STOPPED)[STOPPED] STOPPED->STOPPED),postgres(STOPPED STOPPED),数据(STOPPED->STOPPED),]}"

如果您需要更多信息,请告诉我。

man*_*ish 3

折腾了两天终于找到了。

发生这种情况是因为我的数据和代码库容器正在退出,退出代码为“0”。我将命令更改为“tail -f /bin/bash/”。

前:

    {
      "name": "data",
      "image": "id.dkr.ecr.eu-west-2.amazonaws.com/dbdata:latest",
      "essential": false,
      "memory": 512,
      "command" : [
       "/bin/bash"
      ]
    },
    {
      "name": "codebase",
      "image": "id.dkr.ecr.eu-west-2.amazonaws.com/codebase:latest",
      "essential": false,
      "memory": 512,
      "command" : [
       "/bin/bash"
      ]
    }
Run Code Online (Sandbox Code Playgroud)

后:

       {
          "name": "data",
          "image": "id.dkr.ecr.eu-west-2.amazonaws.com/dbdata:latest",
          "essential": false,
          "memory": 512,
          "command": [
            "tail",
            "-f",
            "/bin/bash"
          ]
        },
        {
          "name": "codebase",
          "image": "id.dkr.ecr.eu-west-2.amazonaws.com/codebase:latest",
          "essential": false,
          "memory": 512,
         "command": [
           "tail",
           "-f",
           "/bin/bash"
         ]
        }
Run Code Online (Sandbox Code Playgroud)

我仍然不明白为什么“基本”标志被忽略!