如果我仅使用containerHost而没有hostPort,则AWS eb的docker设置将不起作用。(多容器Docker)

时间:2019-01-14 13:20:32

标签: amazon-web-services docker amazon-ecs amazon-elastic-beanstalk

弹性豆茎: 在64位Amazon Linux / 2.11.6上运行的多容器Docker

它与eb deploy一起很好地工作。

{
  "AWSEBDockerrunVersion": 2,
  "containerDefinitions": [
        {
      "name": "nextjs",
      "image": "node:8.15.0-alpine",
      "essential": true,
      "memory": 128,
      "portMappings": [
        {
          "hostPort": 3000,
          "containerPort": 3000
        }           
      ]
    }
}

这是行不通的。 ECS任务已停止。

{
  "AWSEBDockerrunVersion": 2,
  "containerDefinitions": [
        {
      "name": "nextjs",
      "image": "node:8.15.0-alpine",
      "essential": true,
      "memory": 128,
      "portMappings": [
        {
          "containerPort": 3000
        }           
      ]
    }
}

eb deploy之后登录

019-01-14 12:59:49    INFO    Environment update is starting.
2019-01-14 12:59:58    INFO    Deploying new version to instance(s).
2019-01-14 13:00:15    WARN    Failed to start ECS task, retrying...
2019-01-14 13:00:15    ERROR   Failed to start ECS task: arn:aws:ecs:us-west-2:625650244102:task/492d1f1e-5fad-4be8-9c7b-6aebb5af157a is STOPPED.
2019-01-14 13:00:15    ERROR   ECS task stopped due to: Essential container in task exited. (nextjs:
nginx-proxy: )
2019-01-14 13:00:16    INFO    ECS task: arn:aws:ecs:us-west-2:625650244102:task/492d1f1e-5fad-4be8-9c7b-6aebb5af157a is STOPPED.
2019-01-14 13:00:19    INFO    Starting new ECS task with awseb-deeo-dev-ubn3e2cd52:27.
2019-01-14 13:00:23    INFO    ECS task: arn:aws:ecs:us-west-2:625650244102:task/62386f55-f50c-4e41-9496-b1ec59694e7e is RUNNING.
2019-01-14 13:00:30    INFO    New application version was deployed to running EC2 instances.
2019-01-14 13:00:30    INFO    Environment update completed successfully.

忽略错别字。

我不知道为什么仅使用containerPort不能正常工作。有人帮我吗?

1 个答案:

答案 0 :(得分:0)

已解决。

为256个以上的nextjs docker环境提供足够的内存。 但是它导致制作多个实例来设置各种内存。因此,使其他容器的内存相同。