azuredockernode-redazure-iot-edgeazure-iot-hub-device-management

Can I run Node-Red under docker on VM EFLOW (Azure IoT edge on windows Device)?


I deployed node-red container aka "IoT edge device module" (nodered/node-red:latest) on an Azure IoT edge device installed on Linux VM on Windows device (EFLOW) based on my experience doing it according to node-red deployment on IoT edge device on Raspberry Pi.

Unfortunately, I face the problem with the following error logs:

    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'
}

Similar problem I faced during deployment of a node-red on IoT edge device on Raspberry Pi. I solved it with the help of community here. I repeated the same things for the EFLOW (VM on Windows), but it didn't work. Practically, I fixed the "Binds":

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

I also described the problem here, though I didn't get any decent help.

Furthermore, as node-red docker is for specific architectures (amd64, arm32v6, arm32v7, arm64v8 and s390x), I also thought I have problems due my system which is:

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

Solution

  • First, this has nothing to do with the CPU architecture (x86-64 is the same as amd64) and the container wouldn't even start if you didn't have a matching CPU arch.

    The problem here is the file permissions on the host OS, in this case most likely the Linux instance in the VM.

    As I described in your last question, what ever path on the host (in this case /home/iotedge-user/node-red) that is mounted on /data in the container needs to be writeable by the uid 1000. How you set that depends on what access you have to the host OS. But assuming you can get a terminal on the host OS then you would run the following command:

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

    This may prompt for your users password to grant sudo access.