Azure IoT Edge Deployment Error

Paul Lee 126 Reputation points
2022-07-11T02:25:34.517+00:00

Hi,

I have been trying to get my deepstream container to run using IoT edge on a Jetson Nano but always keeps on stopping/exiting. In the Azure Portal, the module shows an error. I tried to get the logs for the container by typing sudo iotedge logs Deepstream but no logs. I have also tried iotedge restart command for Deepstream, edgeAgent, edgeHub. No error logs in both the iotedge log output and in the /var/docker/containers/<container id>/<container id>-json.log.

When I restart the Deepstream container I get the following logs in the edgeAgent.

<6> 2022-07-11 03:47:27.375 +00:00 [INF] - Executing command: "Command Group: (\n [Stop module Deepstream]\n [Start module Deepstream]\n [Saving Deepstream to store]\n)"
<6> 2022-07-11 03:47:27.376 +00:00 [INF] - Executing command: "Stop module Deepstream"
<6> 2022-07-11 03:47:27.382 +00:00 [INF] - Executing command: "Start module Deepstream"
<6> 2022-07-11 03:47:28.044 +00:00 [INF] - Executing command: "Saving Deepstream to store"

My working docker command to run my container is

docker run -it -d \
--name test_deepstream \
--restart always \
--runtime nvidia \
--privileged \
--tty \
-v /dev:/dev \
-v /etc/localtime:/etc/localtime \
-v /mnt/test/settings:/settings \
-v /mnt/test/cam:/footage \
-w /usr/src/app/ \
--net=host \
-e PYTHONUNBUFFERED=1 \
-e LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1 \
crtest001.azurecr.io/test_deepstream6_app:release \
/bin/bash -c "python3 main.py /settings/configs/app_config.yaml"

My Azure IoT deployment.json that is not working is

{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.0",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
"loggingOptions": "",
"registryCredentials": {
"crtest001": {
"username": "crtest001",
"password": "SOME PASSWORD",
"address": "crtest001.azurecr.io"
}
}
}
},
"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": "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"
}
}
},
"modules": {
"Deepstream": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "crtest001.azurecr.io/test_deepstream6_app:release",
"createOptions": "{\"Path\":\"/bin/bash\",\"Args\":[\"-c\",\"python3 main.py /settings/configs/app_config.yaml\"],\"Name\":\"/test_deepstream\",\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}},\"HostConfig\":{\"Binds\":[\"/dev:/dev\",\"/etc/localtime:/etc/localtime\",\"/mnt/test/settings:/settings\",\"/mnt/test/cam:/footage\"],\"NetworkMode\":\"host\",\"Privileged\":true,\"Runtime\":\"nvidia\"},\"Mounts\":[{\"Type\":\"bind\",\"Source\":\"/dev\",\"Destination\":\"/dev\",\"Mode\":\"\",\"RW\":true,\"Propagation\":\"rprivate\"},{\"Type\":\"bind\",\"Source\":\"/etc/localtime\",\"Destination\":\"/etc/localtime\",\"Mode\":\"\",\"RW\":true,\"Propagation\":\"rprivate\"},{\"Type\":\"bind\",\"Source\":\"/mnt/test/settings\",\"Destination\":\"/settings\",\"Mode\":\"\",\"RW\":true,\"Propagation\":\"rprivate\"},{\"Type\":\"bind\",\"Source\":\"/mnt/test/cam\",\"Destination\":\"/footage\",\"Mode\":\"\",\"RW\":true,\"Propagation\":\"rprivate\"}],\"Config\":{\"AttachStdin\":true,\"AttachStdout\":true,\"AttachStderr\":true,\"Tty\":true,\"OpenStdin\":true,\"StdinOnce\":true,\"Env\":[\"PYTHONIOENCODING=UTF-8\",\"LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1\",\"PYTHONUNBUFFERED=1\"],\"Cmd\":[\"/bin/bash\",\"-c\",\"python3 main.py /settings/configs/app_config.yaml\"],\"Image\":\"crtest001.azurecr.io/test_deepstream6_app:release\",\"WorkingDir\":\"/usr/src/app\"}}"
}
}
}
}
},
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.0",
"routes": {
"SampleModuleToIoTHub": "FROM /messages/modules/Deepstream/outputs/* INTO $upstream"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
}
}
}

I have tested Module01 in this tutorial to check the Azure IoT Edge is working correctly on the Jetson Nano unit.

https://tsmatz.wordpress.com/2019/10/19/azure-iot-hub-iot-edge-module-container-tutorial-with-message-route/

When I type the docker inspect on the dead Deepstream container, the JSON output does not reflect the same setup/configs as in the deployment.json that was used for the deployment. In the Azure Hub, the Container Create Options seems to be correct and the same as in the deployment.json.

The args are missing when I type docker inspect in the dead docker container.

Path": "/bin/bash",
"Args": [],

"Config": {
"Cmd": [
"/bin/bash"
],

Regards
Paul

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
561 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Paul Lee 126 Reputation points
    2022-07-11T22:32:17.777+00:00

    I fixed it. I needed to add the entrypoint instead cmd. Plus envs need to be outside of configs.

    1 person found this answer helpful.