Azure IoT Edge 模块:Docker 容器 运行 VS 代码部署模板中的时间选项

Azure IoT Edge Module: Docker Container Run Time Options in VS Code Deployment Template

需要使用 docker 运行 时间选项部署 docker 容器“sample/api:v1”,例如 --gpus=all 和 -e DATABASE=NO作为 Azure IoT 边缘模块。如何在 VS Code 中指定这些 docker 运行 时间选项- deployment.template.json

docker 运行 -dt --gpus=all -e DATABASE=NO -p 5656:5656 sample/api:v1

这可能是您要查找的内容,您需要在部署中将其指定为模块的 createOptions JSON:

{
   "ENV":[
      "DATABASE=NO"
   ],
   "HostConfig":{
      "DeviceRequests":[
         {
            "Driver":"",
            "Count":-1,
            "DeviceIDs":null,
            "Capabilities":[
               [
                  "gpu"
               ]
            ],
            "Options":{
               
            }
         }
      ],
      "PortBindings":{
         "5656/tcp":[
            {
               "HostPort":"5656"
            }
         ]
      }
   }
}

ENV 中,您将找到您的环境变量。在 PortBindings 下您可以指定需要打开的端口。

DeviceRequests 下,您将找到等同于 --gpus=all 的创建选项。 Azure IoT Edge 中对此的支持来自 1.0.10,因此请确保更新边缘运行时。检查 here and here 是否有 GitHub 问题,其他人也做过同样的事情。