For anyone that wants to use the ser2net/socat solution with a docker container: I have it working with the docker-compose.yaml file quoted below. I run openHAB in a docker container on my synology NAS. I use socat to add the device /dev/ttyZWave which is linked to a Z-wave stick in a raspberry pi. I first tried to access the /dev/ttyZWave via devices in docker, but that does not work (although the device is visible). When using a simple volumes: mount of the device, it works (although it is a symbolic link to a /dev/pts/xx). I hope it helps someone because it took me some time to get it working.
version: '3'
services:
openhab: #name of the service
container_name: openhab
image: "openhab/openhab:latest"
restart: always
network_mode: host
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/TZ:/etc/timezone:ro"
- "/volume1/docker/openhab/addons:/openhab/addons"
- "/volume1/docker/openhab/conf:/openhab/conf"
- "/volume1/docker/openhab/userdata:/openhab/userdata"
- "/dev/ttyZWave:/dev/ttyACM0" # for Z-wave stick
environment:
USER_ID: "1035"
GROUP_ID: "65539"
OPENHAB_HTTP_PORT: "18080"
OPENHAB_HTTPS_PORT: "18443"
EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Amsterdam"