Musing on Docker and Linux serial dev #40

Closed
opened 2026-10-05 01:54:33 +02:00 by adam · 1 comment
Owner

I noticed with the default device mapping (/dev/ttyACM0:/dev/ttyUSB0), if I unplugged the device sometimes it wouldn't get re-connected on re-plug.
Also I think if I started the docker container before connecting the device.

I had a similar issue with serial devices in HomeAssistant, and their (eventual) suggestion was to use the /dev/serial/by-id/... node when possible. Somehow it gets mapped properly on hotplug???

So my docker-compose.override.yaml I have:

services:
  remoteterm:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        COMMIT_HASH: ${COMMIT_HASH:-unknown}
    devices:
      - /dev/serial/by-id/usb-Espressif_Systems_heltec_wifi_<snip>:/dev/ttyUSB0

Not sure if this helps anyone. Or if it even works -- sample size of "today".

I noticed with the default device mapping (`/dev/ttyACM0:/dev/ttyUSB0`), if I unplugged the device sometimes it wouldn't get re-connected on re-plug. Also I think if I started the docker container before connecting the device. I had a similar issue with serial devices in HomeAssistant, and their (eventual) suggestion was to use the `/dev/serial/by-id/...` node when possible. Somehow it gets mapped properly on hotplug??? So my `docker-compose.override.yaml` I have: ``` services: remoteterm: build: context: . dockerfile: Dockerfile args: COMMIT_HASH: ${COMMIT_HASH:-unknown} devices: - /dev/serial/by-id/usb-Espressif_Systems_heltec_wifi_<snip>:/dev/ttyUSB0 ``` Not sure if this helps anyone. Or if it even works -- sample size of "today". <!-- github-sync-id:4090003693 -->
adam closed this issue 2026-10-05 01:54:33 +02:00
Author
Owner

Yeah the ID will always be stable and is wise to use for mapping as it's deterministic. I'm not sure how Docker treats hotplugged serial devices that are mapped right in the config but not connected at startup time, but glad to here that an ID-mapped approach worked well for you.

Yeah the ID will always be stable and is wise to use for mapping as it's deterministic. I'm not sure how Docker treats hotplugged serial devices that are mapped right in the config but not connected at startup time, but glad to here that an ID-mapped approach worked well for you. <!-- github-comment-id:4076759041 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Remote-Terminal-for-MeshCore#40