【问题标题】:Can I run Node-Red under docker on VM EFLOW (Azure IoT edge on windows Device)?我可以在 VM EFLOW(Windows 设备上的 Azure IoT edge)上的 docker 下运行 Node-Red 吗?
【发布时间】:2022-11-19 19:49:08
【问题描述】:

根据我根据@987654322 的经验,我在安装在 Windows 设备 (EFLOW) 上的 Linux VM 上的 Azure IoT 边缘设备上部署了节点红色容器又名“物联网边缘设备模块”(nodered/node-red:latest) @.

不幸的是,我遇到了以下错误日志的问题:

    Error: EACCES: permission denied, copyfile '/usr/src/node-red/node_modules/node-red/settings.js' -> '/data/settings.js'
    at Object.copyFileSync (node:fs:2817:3)
    at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:73:6)
    at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:59:25)
    at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:51:44)
    at handleFilterAndCopy (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:36:10)
    at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:29:10)
    at Object.<anonymous> (/usr/src/node-red/node_modules/node-red/red.js:129:20)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  errno: -13,
  syscall: 'copyfile',
  code: 'EACCES',
  path: '/usr/src/node-red/node_modules/node-red/settings.js',
  dest: '/data/settings.js'
}

我在 Raspberry Pi 上的 IoT 边缘设备上部署 node-red 时遇到了类似的问题。我在社区here 的帮助下解决了它。我对 EFLOW(Windows 上的虚拟机)重复了同样的操作,但没有用。实际上,我修复了“绑定”:

"Binds": [
            "/home/iotedge-user/node-red:/data"
        ],

我也描述了问题here,虽然我没有得到任何像样的帮助。

此外,由于 node-red docker 用于特定架构(amd64、arm32v6、arm32v7、arm64v8 和 s390x),我还认为我的系统存在问题:

Virtualization: microsoft
Operating System: CBL-Mariner/Linux
Kernel: Linux 5.15.67.1-4.cm2
Architecture: x86-64
Hardware Vendor: Microsoft Corporation
Hardware Model: Virtual Machine

【问题讨论】:

    标签: azure docker node-red azure-iot-edge azure-iot-hub-device-management


    【解决方案1】:

    首先,这与 CPU 架构无关(x86-64 与 amd64 相同),如果没有匹配的 CPU 架构,容器甚至不会启动。

    这里的问题是主机操作系统上的文件权限,在这种情况下很可能是 VM 中的 Linux 实例。

    正如我在上一篇 question 中所述,安装在容器中 /data 上的主机(在本例中为 /home/iotedge-user/node-red)上的任何路径都需要由 uid 1000 写入。如何设置取决于什么您必须访问主机操作系统。但假设您可以在主机操作系统上获得一个终端,那么您将运行以下命令:

    sudo chown -R 1000:1000 /home/iotedge-user/node-red
    

    这可能会提示您输入用户密码以授予 sudo 访问权限。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-16
      相关资源
      最近更新 更多