如何在AWS的任务定义中设置环境变量

时间:2019-09-11 05:29:04

标签: c# amazon-web-services docker amazon-ecs

我是AWS Docker的新手,我想在ECS的任务定义中设置一个环境变量,然后从Docker容器的C#代码中读取它。首先,有可能吗?如果是,该如何实现?

下面是我的task.json文件

{
  "family": "task-logging-poc",
  "containerDefinitions": [
    {
      "image": "XYZ",
      "name": "logging-poc-1",
      "cpu": 1024,
      "memory": 1024,
      "essential": true,
      "mountPoints": [
        {
          "sourceVolume": "log",
          "containerPath": "c:/data"
        }
      ]
    }
  ]
}

1 个答案:

答案 0 :(得分:1)

像这样:

"environment" : [
    { "name" : "string", "value" : "string" },
    { "name" : "string", "value" : "string" }
]

请参阅this