IotEdge-调用创建模块图像分类器服务时出错

时间:2019-05-24 10:02:22

标签: azure azure-iot-hub azure-iot-edge

我是Azure IoT Edge的新手,我正尝试部署到我的Raspberry PI:Azure IoT Edge和认知服务的图像识别 但是在构建并推送IoT Edge解决方案并将其部署到单个设备ID之后,我看不到Docker PS -a和Iotedge列表中列出的这两个模块都没有 当尝试在EdgeAgent日志上检查它时,会出现错误消息,并且在创建这些模块(相机捕获和图像分类器服务)时,EdgeAgent似乎出错了

我尝试过: 1.从新文件夹包重新构建 2.从Azure门户手动提取图像并通过脚本手动运行图像

我坚持了好几天。

对于那些模块,在deployment.arm32v7.json中

我定义了具有注册注册表URL的映像:

"modules": {
          "camera-capture": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "zzzz.azurecr.io/camera-capture-opencv:1.1.12-arm32v7",
              "createOptions": "{\"Env\":[\"Video=0\",\"azureSpeechServicesKey=2f57f2d9f1074faaa0e9484e1f1c08c1\",\"AiEndpoint=http://image-classifier-service:80/image\"],\"HostConfig\":{\"PortBindings\":{\"5678/tcp\":[{\"HostPort\":\"5678\"}]},\"Devices\":[{\"PathOnHost\":\"/dev/video0\",\"PathInContainer\":\"/dev/video0\",\"CgroupPermissions\":\"mrw\"},{\"PathOnHost\":\"/dev/snd\",\"PathInContainer\":\"/dev/snd\",\"CgroupPermissions\":\"mrw\"}]}}"
            }
          },
          "image-classifier-service": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "zzzz.azurecr.io/image-classifier-service:1.1.5-arm32v7",
              "createOptions": "{\"HostConfig\":{\"Binds\":[\"/home/pi/images:/images\"],\"PortBindings\":{\"8000/tcp\":[{\"HostPort\":\"80\"}],\"5679/tcp\":[{\"HostPort\":\"5679\"}]}}}"
            }

EdgeAgent日志中的错误消息:

(Inner Exception #0) Microsoft.Azure.Devices.Edge.Agent.Edgelet.EdgeletCommunicationException- Message:Error calling Create module
image-classifier-service: Could not create module image-classifier-service
        caused by: Could not pull image zzzzz.azurecr.io/image-classifier-service:1.1.5-arm32v7
        caused by: Get https://zzzzz.azurecr.io/v2/image-classifier-service/manifests/1.1.5-arm32v7: unauthorized: authentication required

尝试通过脚本运行提取的图像时:

sudo docker run --rm --name testName -it zzzz.azurecr.io/camera-capture-opencv:1.1.12-arm32v7

没有

我收到此错误:

Camera Capture Azure IoT Edge Module. Press Ctrl-C to exit.
Error: Time:Fri May 24 10:01:09 2019 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core_ll.c Func:retrieve_edge_environment_variabes Line:191 Environment IOTEDGE_AUTHSCHEME not set
Error: Time:Fri May 24 10:01:09 2019 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core_ll.c Func:IoTHubClientCore_LL_CreateFromEnvironment Line:1572 retrieve_edge_environment_variabes failed
Error: Time:Fri May 24 10:01:09 2019 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core.c Func:create_iothub_instance Line:941 Failure creating iothub handle
Unexpected error IoTHubClient.create_from_environment, IoTHubClientResult.ERROR from IoTHub

1 个答案:

答案 0 :(得分:1)

当您使用someState直接拉出图像时,图像被拉出,但随后无法在边缘运行时之外运行,这是预期的。但是,当边缘代理尝试拉出它时,它失败了,因为它未被授权。没有凭据提供给运行时,因此它尝试匿名访问注册表。

确保将容器注册表凭据添加到部署中,以便边缘运行时可以提取映像。部署在运行时设置中应包含以下内容:

customHookValue

正如@silent在评论中指出的,文档为here,包括一个包含容器注册表凭据的示例部署。