IoTEdge 有时会重新创建容器

IoTEdge sometimes re-creates the container

我们是 运行 物联网边缘模块。在我们的模块中,我们更新了一堆文件。我们注意到,大多数情况下,如果主机重启,容器也会重启,我们更新的文件仍然存在。 然而,很少有几次,我们注意到当主机重新启动时,容器是从原始图像重新创建的,因此所有数据更改都丢失了。

我们的理解是,iot edge 正在使用 docker 重启策略 = always,它应该始终保留容器的数据。

我有下一个建议:

  1. 不在容器可写层存储重要数据=>不依赖重启策略
  2. 重建容器的原因可能是部署了新版本的模块映像,因此使用新映像重新创建了容器
  3. 设置您的模块部署清单(example) properly by using the module container createOptions and attach a local volume to the container (createOptions->HostConfig->Binds), and store your data there. This will survive any recreations of your module container . See example。类似于:

    "createOptions": { "HostConfig": { "Binds": [ "/app/db:/app/db" ] } }