【问题标题】:AWS eb's docker setting is not work if I use only containerPort without hostPort.(Multi-container Docker)如果我只使用没有 hostPort 的 containerPort,AWS eb 的 docker 设置将不起作用。(多容器 Docker)
【发布时间】:2019-06-08 11:47:24
【问题描述】:

弹力豆茎: 在 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,我不知道为什么它不起作用。有人帮帮我吗?

【问题讨论】:

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


    【解决方案1】:

    解决了。

    为 nextjs docker 环境提供足够的内存超过 256。 但它会导致创建多个实例来设置各种内存。所以,让其他容器的内存相同。

    【讨论】:

      猜你喜欢
      • 2019-01-15
      • 2020-10-31
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 2019-07-15
      • 1970-01-01
      • 2021-11-25
      • 2018-01-19
      相关资源
      最近更新 更多