Skip to content

Docker release container cannot list serial devices #686

@carlos-jenkins

Description

@carlos-jenkins

I was trying the instructions currently in the README:

docker run -device=/dev/ttyUSB0 -p 8000:8000 joesantos/laserweb:latest

Everything works great, but when I try to connect to the laser, the drop-down looks empty. Went debugging, and the reason is as follows:

  1. lw.comm-server enumerates the devices using serialport.list() here: https://github.com/LaserWeb/lw.comm-server/blob/75aa7f1ece5947acb4d209642d4ad44b093cdc6d/server.js#L227
  2. list() returns nothing in Linux.
  3. serialport.list() API documentation indicates that it will call the cpp bindings
  4. The bindings code for Linux calls under the hood the command udevadm info -e.
  5. The release container doesn't has the udevadm command installed. So the call fails and returns nothing.

Fix:

Install the package udev in the release container.

$ git diff
diff --git a/Dockerfile.release b/Dockerfile.release
index 1bd1df4..137d08d 100644
--- a/Dockerfile.release
+++ b/Dockerfile.release
@@ -16,6 +16,8 @@ FROM node:10-alpine
 ENV ENV="production"
 ENV NODE_ENV="production"
 
+RUN apk add --no-cache udev
+
 WORKDIR /app
 COPY --from=base /app ./

I will send a PR with this. Mentioning @iamajoe who worked on this for validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions