IotEdge Module Image update on DevBox

Once you have deployed the IoTEdge solution, you will have to start maintenance.

If the module is correctly installed on the edge, you will see following images in docker.

> docker images
REPOSITORY                             TAG                                 CREATED
abc.azurecr.io/abc                 0.2-linux                            3 days ago  
microsoft/dotnet                       2.1-sdk                          4 days ago  
microsoft/dotnet                       2.1-aspnetcore-runtime           5 days ago  
mcr.microsoft.com/azureiotedge-hub     1.0                              6 days ago  
mcr.microsoft.com/azureiotedge-agent   1.0                              6 days ago  
eclipse-mosquitto                      latest                           7 monthsago

Please note the module abc.azurecr.io/abc. It is created 3 days ago. At some point of time you will have to perform update of the image. To do this, do some changes in the module and build it again.

But, before you do that, stop iotedge service.

On windows:

stop-service iotedge -NoWait

on Linux

sudo systemctl stop iotedge

Now, you can do build of the image. I did a build with following command:

docker build --rm -f modules\EebusEdgeCore\Dockerfile.build -t abc.azurecr.io/eebus:0.2-linux .

If you execute docker images command, you will notice following:

> docker images
REPOSITORY                             TAG                                 CREATED
abc.azurecr.io/abc                 0.2-linux                     About a minute ago  
microsoft/dotnet                       2.1-sdk                          4 days ago  
microsoft/dotnet                       2.1-aspnetcore-runtime           5 days ago  
mcr.microsoft.com/azureiotedge-hub     1.0                              6 days ago  
mcr.microsoft.com/azureiotedge-agent   1.0                              6 days ago  
eclipse-mosquitto                      latest                           7 monthsago

Note that the image abc.azurecr.io is generated a minute ago, which is fine. As next start your iotedge runtime.

On windows:

start-service iotedge

on Linux

sudo systemctl start iotedge

After a while (usually few seconds) see your images again:

> docker images
REPOSITORY                             TAG                                 CREATED
abc.azurecr.io/abc                 0.2-linux                            3 days ago  
microsoft/dotnet                       2.1-sdk                          4 days ago  
microsoft/dotnet                       2.1-aspnetcore-runtime           5 days ago  
mcr.microsoft.com/azureiotedge-hub     1.0                              6 days ago  
mcr.microsoft.com/azureiotedge-agent   1.0                              6 days ago  
eclipse-mosquitto                      latest                           7 monthsago

You will notice, that abc.azurecr.io/abc have need overwritten by image stored in cloud registry. Notice "3 days ago". This indicates, that iot runtime is running the image from cloud registry and not you image built on the box.

Conclusion

New version of images installed on the box (it doe not matter how) of the same version do overwrite existing images of the same version. This is how Docker works.

However, IotEdge runtime will overwrite image on the box from docker registry with the same version, even if the image on the box is newer one.