Raspberry PI/IOTEdge 无法从 Azure 容器注册表中提取 [英] Raspberry PI / IOTEdge failing to pull from Azure Container Registry

查看:77
本文介绍了Raspberry PI/IOTEdge 无法从 Azure 容器注册表中提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 IOTEdge 设备 (Rapi3),并且部署并运行了 IotEdgeHub 和 IotEdgeagent.

我已成功构建和部署图像(

解决方案

发送到设备的 deployment.json 应如下所示(如果您确实使用 ACR 管理员凭据而不是推荐服务原则):

"registryCredentials": {注册表名称":{"username": "myregistryname","密码": "xxxxxxxxxxxxxxxxxxxxx",地址":myregistryname.azurecr.io"}}

你能确认你的 deployment.json 看起来像这样吗?

I have an IOTEdge device (Rapi3) and IotEdgeHub and IotEdgeagent are deployed and running.

I have successfully built and deployed images (custom-vision example) to ACR and have configured Access Keys in the portal. I've added the respective credentials to my .env file.

The deployment.json has been deployed using Create deployment for single device.

Within IotAgent logs I can see a series of 500 errors:

Executing command for operation ["create"] failed. Microsoft.Azure.Devices.Edge.Agent.Edgelet.EdgeletCommunicationException- Message:Error calling Create module camera-capture: Could not create module camera-capture caused by: Could not pull image myregistryname.azurecr.io/azurev1/cameracapture:0.2.7-arm32v7 caused by: Get https://myregistryname.azurecr.io/v2/azurev1/cameracapture/manifests/0.2.7-arm32v7: unauthorized: authentication required, StatusCode:500

I have already run sudo docker login -u myregistryname -p accesskeypassword1 myregistryname.azurecr.io/azurev1 successfully

I can run sudo docker pull myregistryname.azurecr.io/azurev1/cameracapture:0.2.7-arm32v7 manually which successfully download the respective image.

It would appear that IotEdgeHub and/or IotEdgeAgent doesn't have the same access to the ACR. How can I elevate the privileges.


Update; my deployment.template.json file is as follows:

{
  "moduleContent": {
    "$edgeAgent": {
      "properties.desired": {
        "schemaVersion": "1.0",
        "runtime": {
          "type": "docker",
          "settings": {
            "minDockerVersion": "v1.25",
            "loggingOptions": "",
            "registryCredentials": {
              "registryName": {
                "username": "$CONTAINER_REGISTRY_USERNAME",
                "password": "$CONTAINER_REGISTRY_PASSWORD",
                "address": "$CONTAINER_REGISTRY_ADDRESS"
              }
            }
          }
        },
        "systemModules": {
          "edgeAgent": {
            "type": "docker",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-agent:1.0",
              "createOptions": ""
            }
          },
          "edgeHub": {
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "mcr.microsoft.com/azureiotedge-hub:1.0",
              "createOptions": ""
            },
            "env": {
                "OptimizeForPerformance": {
                  "value": "false"
                }
            }
          }
        },
        "modules": {
          "camera-capture": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "env": {
              "VIDEO_PATH": {"value": 0},
              "IMAGE_PROCESSING_ENDPOINT":  {"value": "http://image-classifier-service:80/image"},
              "RESIZE_WIDTH":  {"value": 256},
              "RESIZE_HEIGHT":  {"value": 256},
              "SHOW_VIDEO":  {"value": "True"}
            },
            "settings": {
              "image": "${MODULES.CameraCapture.arm32v7}",
              "createOptions": {
                "HostConfig": {
                  "PortBindings": {
                    "5012/tcp": [ { "HostPort":"5012"}]
                  },
                  "Binds": ["/dev/video0:/dev/video0"],
                  "Devices":[{"PathOnHost":"/dev/video0","PathInContainer":"/dev/video0","CgroupPermissions":"mrw"}]
                }
              }
            }
          },
          "sensehat-display": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "env": {
              "THRESHOLD": {"value": 0.6}
            },
            "settings": {
              "image": "${MODULES.SenseHatDisplay.arm32v7}",
              "createOptions": {
                "HostConfig":{
                  "Binds":["/dev/i2c1:/dev/i2c1"],
                  "Privileged":true
                }
              }
            }
          },
          "image-classifier-service": {
            "version": "1.0",
            "type": "docker",
            "status": "running",
            "restartPolicy": "always",
            "settings": {
              "image": "${MODULES.ImageClassifierService.arm32v7}",
              "createOptions": ""
            }
          }
        }
      }
    },
    "$edgeHub": {
      "properties.desired": {
        "schemaVersion": "1.0",
        "routes": {
          "CameraCaptureToSenseHatDisplay": "FROM /messages/modules/camera-capture/outputs/output1 INTO BrokeredEndpoint(\"/modules/sensehat-display/inputs/input1\")",
          "CameraCaptureToIoTHub": "FROM /messages/modules/camera-capture/outputs/output1 INTO $upstream",
          "CameraCaptureGAToIoTHub": "FROM /messages/modules/CameraCaptureGA/outputs/* INTO $upstream"
        },
        "storeAndForwardConfiguration": {
          "timeToLiveSecs": 7200
        }
      }
    }
  }
}

Settings as displayed in the portal:

解决方案

The deployment.json that gets send to the device should look like this (if you do use the ACR admin credentials and not the recommended service principle):

"registryCredentials": {
    "registryName": {
        "username": "myregistryname",
        "password": "xxxxxxxxxxxxxxxxxxx",
        "address": "myregistryname.azurecr.io"
     }
 }

Can you confirm your deployment.json looks like this?

这篇关于Raspberry PI/IOTEdge 无法从 Azure 容器注册表中提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆