I want to run a zigbee2mqtt container.

I need to bind a device to the container doing :

  - "/dev/serial/by-id/usb-Texas_Instruments_\

And I wand to launch as another user like :


But it hangs with an error I presume its right access (no error when I don't specify user). There is the error log :

  zigbee2mqtt:info 10/27/2019, 5:18:17 PM Logging to directory: '/app/data/log/2019-10-27.17-18-17'
  zigbee2mqtt:info 10/27/2019, 5:18:18 PM Starting zigbee2mqtt version 1.6.0 (commit #e26ad2a)
  zigbee2mqtt:info 10/27/2019, 5:18:18 PM Starting zigbee-shepherd
      throw er; // Unhandled 'error' event

Error: Port is not open
    at SerialPort.close (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/stream.js:425:29)
    at Znp.<anonymous> (/app/node_modules/zigbee-herdsman/dist/znp/znp.js:107:37)
    at Generator.next (<anonymous>)
    at /app/node_modules/zigbee-herdsman/dist/znp/znp.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/zigbee-herdsman/dist/znp/znp.js:3:12)
    at SerialPort.serialPort.open (/app/node_modules/zigbee-herdsman/dist/znp/znp.js:103:45)
    at SerialPort._error (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/stream.js:197:14)
    at binding.open.then.err (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/stream.js:241:12)
Emitted 'error' event at:
    at SerialPort.onerror (_stream_readable.js:690:12)
    at SerialPort.emit (events.js:182:13)
    at SerialPort._error (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/stream.js:199:10)
    at process.nextTick (/app/node_modules/zigbee-herdsman/node_modules/@serialport/stream/stream.js:204:31)
    at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.6.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the zigbee2mqtt@1.6.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

What's the options/best way to solve this ?
I don't see any security issue giving a user full rights to this CC2531 (Zigbee receiver)


I can't remember if/how to do user mapping in docker. However I would just use file permissions: add a new group (zigbee_device) to the host, set permission on the device so that users in this group can read and write. Then have the container run with it as one of its groups.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.