USB Passthrough (for Modbus) from Pi 5 to a Docker container

I would like to pass though an USB FTDI RS485 to Node-RED on a RPi 5.

This is my compose file:

services:
  node-red_dev:
    image: nodered/node-red:4.0.2
    container_name: node-red_dev
    restart: unless-stopped
    privileged: true
    user: node-red
    group_add:
      - dialout
    ports:
      - 1880:1880
    networks:
      - net
    volumes:
      - dev_data:/data
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0

networks:
  net:

volumes:
  dev_data:

This is the output from the console:

~$ whoami
node-red
~$ id
uid=1000(node-red) gid=1000(node-red) groups=20(dialout),1000(node-red)
~$ ls -l /dev/ttyUSB0
crw-rw----    1 root     dialout   188,   0 Jul 16 12:57 /dev/ttyUSB0
~$ dmesg | grep ttyUSB
[   30.610798] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0

I can see the FTDI device in the console but I can't get the node-red-contrib-modbus node to work in Node-RED.

Not sure if there is a dialout group mismatch.

I am out of my depth and any assistance would be appreciated. TIA.

When you say console, you mean on the host or a shell inside the container?

The above is from inside the container. Below is from the host.

~$ whoami
pi
~$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Jul 17 18:17 /dev/ttyUSB0
~$ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),102(input),105(render),106(netdev),993(gpio),994(i2c),995(spi)

So by using image tag 4.0.0-debian it works. Assume it something to do with Alpine base?

What host OS are you running on? 32 or 64bit?

Raspberry Pi OS Lite 64bit

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.