IoT Edge : device can't download my module fro

2019-03-02 08:57发布

问题:

I followed this azure example to develop my module connectedbarmodule in python for Azure IoT Edge. Then , I followed this link to deploy my module in my device (raspberry pi 3). However, my module can't be downloaded. Then, I executed the following command on my device :

sudo docker logs -f edgeAgent

I have the following error:

Error calling Create module ConnectedBarModule:
Get https://iotedgeregistery.azurecr.io/v2/connectedbarmodule/manifests/0.0.1-amd64:
unauthorized: authentication required) 

This is an url regarding my Azure Container Registry where the image of my module is stored. I don't know how to get the credentials for iotedge to download my module.

I tested the case to pu the image not in the Azure Container Registry but in my dockerhub account and it works, my device can download the module.

If someone has an idea, this would be very kind.

Thank you in advance.

回答1:

Your Azure Container Registry is private. Hence, you need to add the credentials for it in order for the edgeAgent to be download images from private registries:

  • Through the Azure Portal: In the first step of "Set Modules"

  • When done through deployments in Visual Studio Code:

"In the VS Code explorer, open the .env file. Update the fields with the username and password values that you copied from your Azure container registry." (https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-c-module#add-your-registry-credentials)



回答2:

For your issue, you can use the command docker login -u <ACR username> -p <ACR password> <ACR login server> which shows in the example you posted. About the authentication of Azure Container Registry, there are two ways you can choose.

One is that use the user and password which shows in your ACR on the Azure portal.

Another is that you can use the Azure Service Principal, you can set the permission for the user. Follow document Azure Container Registry authentication with service principals. I would suggest this way much more than the first because it's safer.

It's just an advice. Hope this will help you and if you need more help please show me the message.