USB printer device setting on docker

Trying to move my octoprint from windows to docker on linux. Printer works great on windows octoprint, just looking to move it off the windows box since its the only thing running on the windows box anymore. Moved to linux. :slight_smile:

What is the problem?

Trying to get octoprint docker to see usb printer.

What did you already try to solve it?

uncommented dev/ttyACM0:/dev/ttyACM0 - no luck, also tried - /dev/ttyUSB0:/dev/ttyUSB0

tried using python -m serial.tools.miniterm to get usb returns /dev/ttyS0 thru /dev/ttyS31 - all say 'N/A'

running lsusb returns Bus 001 Device 006: ID 1a86:7523 QinHeng Electronics CH340 serial converter, which only appears when the printer is plugged in, so believe is the printer.

Systeminfo Bundle

You can download this in
octoprint-systeminfo-20240407040642.zip (8.4 KB)
OctoPrint's System Information dialog ... no bundle, no support!)

system info attached

Additional information about your setup

OctoPrint version: 1.9.3, printer: Ender 3, operating system: pop os 22.04, docker desktop v4.28.0

Docker compose

version: '2.4'

services:
  octoprint:
    image: octoprint/octoprint
    restart: unless-stopped
    ports:
      - 80:80
    devices:
    # use `python -m serial.tools.miniterm` to see what the name is of the printer, this requires pyserial
      - /dev/ttyACM0:/dev/ttyACM0
    #  - /dev/video0:/dev/video0
    volumes:
     - octoprint:/octoprint
    # uncomment the lines below to ensure camera streaming is enabled when
    # you add a video device
    #environment:
    #  - ENABLE_MJPG_STREAMER=true
  
  ####
  # uncomment if you wish to edit the configuration files of octoprint
  # refer to docs on configuration editing for more information
  ####

  #config-editor:
  #  image: linuxserver/code-server
  #  ports:
  #    - 8443:8443
  #  depends_on:
  #    - octoprint
  #  restart: unless-stopped
  #  environment:
  #    - PUID=0
  #    - PGID=0
  #    - TZ=America/Chicago
  #  volumes:
  #    - octoprint:/octoprint

volumes:
  octoprint:

Small update, I am able to see /dev/ttyUSB0 now via the python call. Removed brltty which was causing an issue. But still can't connect to the printer via docker when added the device line.

rob@pop-os:~/Docker/OctoPrint$ docker compose -f docker-compose.yml up -d
[+] Running 0/1
 β ™ Container octoprint-octoprint-1  S...                                   0.1s 
Error response from daemon: error gathering device information while adding custom device "/dev/ttyUSB0": no such file or directory
rob@pop-os:~/Docker/OctoPrint$ 

Hi, did you resolve this?
I'm trying to get a connection since months.
I tried everything I could find, no luck.
I'm trying to move from raspberry pi to Ubuntu docker this is what I did until now:

  • checked ttyUSB0
  • checked drivers
  • checked permissions
  • changed usb cable
  • changed usb cable to only data
  • tried using portainer Stacks, docker compose, docker run
  • tried different ports
  • tried running Container in privileged Mode and used /dev
  • tried using /dev/serial/by-id
  • changed connection settings in octoprint multiple times
  • rebooting docker machine
  • rebooting printer
  • Backup pi, restore Container from pi backup
  • removed brltty

The Container is running fine to but I can't get a connection.
I can put the printer back into the pi and it works fine.

Unfortunately I never found a solution either. Even tried installing Ubuntu instead of pop os but ended up trying all same things still not getting it to work. Ended up dusting off my old pi to run octoprint for now. May retry it again fi any new solutions present themselves.

Is klipper running on your printer?
I had completely forgotten that I had to install other klipper packages on the pi besides the octoklipper plugin. The octoprint docker version itself doesn't have all that, so I tried a fluidd/mainraker/klipper
container. It worked immediately!
That means all my settings were correct, only octoprint just couldn't do anything with klipper.
At least that's what I think as a docker beginner :smiley: