Using edge to update version number

Omar Navarro 326 Reputation points
2022-10-19T20:42:30.01+00:00

When using the command to apply a new manifest, it seems that the new module is ignored if the module contains the same name that was present at the original manifest. Can Azure IoT Edge be used to only increment an image version number while preserving the original container name? Or has anyone found a workaround this issue?

   sudo az iot edge set-modules --hub-name "$IOT_HUB_NAME" --device-id "$DEVICE_ID" --content "$MANIFEST_FILE_JSON" --only-show-error -o table  
Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
383 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,031 Reputation points
    2022-10-19T23:26:07.38+00:00

    Hello @Omar Navarro ,

    What is the tag of the module image , are you using it?

    Use tags to manage versions

    A tag is a docker concept that you can use to distinguish between versions of docker containers. Tags are suffixes like 1.1 that go on the end of a container repository. For example, mcr.microsoft.com/azureiotedge-agent:1.1. Tags are mutable and can be changed to point to another container at any time, so your team should agree on a convention to follow as you update your module images moving forward.

    Tags also help you to enforce updates on your IoT Edge devices. When you push an updated version of a module to your container registry, increment the tag. Then, push a new deployment to your devices with the tag incremented. The container engine will recognize the incremented tag as a new version and will pull the latest module version down to your device.

    The Edge runtime is designed to detect changes in deployments. So if nothing has materially changed in the deployment definition itself (even if something referred to from the deployment — such as the image definition referred to by a tag — changes) then Edge does not take any action.

    So we have a the following options:

    1. Use a unique tag for every image
    2. Change the “version” property in the module’s entry to a new value every time
    3. Delete the module from the deployment and then add it back

    Or if this is during development then you could simply run “docker rm -f <module id>” and that should cause Edge to download the image afresh.

    Also Refer to similar: Link

    when image bits are updated it is a good practice to update the tag as well. And it should be safe to update the deployment, i.e., change just the tag for the module in question and leave all other module definitions in tact. Edge will only redeploy that one module that was updated.

    If the response is helpful, please click "Accept Answer" and upvote it. So that we can close this thread.

    0 comments No comments