docker-octoprint
docker-octoprint copied to clipboard
Add instructions for passing USB port to docker container
Suggest adding instructions to to identify the USB port being used and then passing this device into the container.
With the pi connected to the printer via usb
ls /dev | grep tty
This should return a long list of 'tty' The one we need is found at the end of the list and is probably
ttyUSB0
if no other USB devices are plugged in.
In order to use this ttyUSB0
add this to your docker run command
docker run -device /dev/ttyUSB0:/dev/ttyUSB0 .....
Now octoprint can detect the the USB port and connect to the printer.
Hello,
I have an asustor machine on which I installed a dsm system, from synology, in which I installed the graphical application "docker", and I don't see how to pass this parameter.
Whether to put it in environment variables or elsewhere.
maybe in the octoprint.json ... i don't know.
Hello,
I have an asustor machine on which I installed a dsm system, from synology, in which I installed the graphical application "docker", and I don't see how to pass this parameter. Whether to put it in environment variables or elsewhere. maybe in the octoprint.json ... i don't know.
I don't use docker on a DSM system but a quick search reveals that there should be an "advanced settings" tab where you can configure more docker settings.
see> https://www.baitando.de/it/2019/09/22/using-docker-on-synology-nas
DSM docker UI application does not have option to set "device".
But you still can do this by following steps:
- create "octoprint" container with all settings you need (volumes, ports etc)
- select "Settings" -> "Export" and export docker container configuration JSON to local computer
- open exported JSON in any editor
- find string
"devices" : null,
and replace it with
"devices" : [
{
"pathOnHost": "/dev/ttyUSB0",
"PathInContainer": "/dev/ttyUSB0",
"CgroupPermissions": "rwm"
}
],
- Import JSON file back to DSM docker UI
P.S. Also I found that my "/dev/ttyUSB0" has "crw-------" permission, and can't be accessed inside docker by octoprint application. So I have to manually set to "crw-rw-rw-" with
chmod a+rw /dev/ttyUSB0
Suggest adding instructions to to identify the USB port being used and then passing this device into the container.
With the pi connected to the printer via usb
ls /dev | grep tty
This should return a long list of 'tty' The one we need is found at the end of the list and is probably
ttyUSB0
if no other USB devices are plugged in.In order to use this
ttyUSB0
add this to your docker run command
docker run -device /dev/ttyUSB0:/dev/ttyUSB0 .....
Now octoprint can detect the the USB port and connect to the printer.
Hi i installed everything and it works. unfortunately I can't enable the usb and launching the command (pi4): docker: invalid reference format: repository name must be lowercase. See 'docker run --help'.
some advice?
DSM docker UI application does not have option to set "device".
But you still can do this by following steps:
- create "octoprint" container with all settings you need (volumes, ports etc)
- select "Settings" -> "Export" and export docker container configuration JSON to local computer
- open exported JSON in any editor
- find string
"devices" : null,
and replace it with
"devices" : [ { "pathOnHost": "/dev/ttyUSB0", "PathInContainer": "/dev/ttyUSB0", "CgroupPermissions": "rwm" } ],
- Import JSON file back to DSM docker UI
P.S. Also I found that my "/dev/ttyUSB0" has "crw-------" permission, and can't be accessed inside docker by octoprint application. So I have to manually set to "crw-rw-rw-" with
chmod a+rw /dev/ttyUSB0
This allowed me to get Octopi working with Docker on my Synology NAS, thanks! On that hardware, the interface is /dev/ttyACM0
Unfortunately I can't customize the Octoprint port, so had to manually enter it into LulzBot Cura, but otherwise everything is working awesome!
DSM docker UI application does not have option to set "device". But you still can do this by following steps:
- create "octoprint" container with all settings you need (volumes, ports etc)
- select "Settings" -> "Export" and export docker container configuration JSON to local computer
- open exported JSON in any editor
- find string
"devices" : null,
and replace it with
"devices" : [ { "pathOnHost": "/dev/ttyUSB0", "PathInContainer": "/dev/ttyUSB0", "CgroupPermissions": "rwm" } ],
- Import JSON file back to DSM docker UI
P.S. Also I found that my "/dev/ttyUSB0" has "crw-------" permission, and can't be accessed inside docker by octoprint application. So I have to manually set to "crw-rw-rw-" with
chmod a+rw /dev/ttyUSB0
This allowed me to get Octopi working with Docker on my Synology NAS, thanks! On that hardware, the interface is
/dev/ttyACM0
Unfortunately I can't customize the Octoprint port, so had to manually enter it into LulzBot Cura, but otherwise everything is working awesome!
Hi Guys so basically I am a bit lost here... octoprint itself is running in my docker on my DSM. i connected the printer Anycubic 4Max Pro to the front port and to the back one. When turning Serial and Baud to automatic i get the error offline no more candidates to test indicating the applications has not found my printer. when Shh into my dsm i can find the usb device Silicon Labs CP2102N USB to UART Bridge Controller.
in Octoprint i have the options for ttyS0 -S3 i have edited these directories as well as tried other names like USB3 with chmod but could not get it to work. what am i doing wrong? BR
This allowed me to get Octopi working with Docker on my Synology NAS, thanks! On that hardware, the interface is
/dev/ttyACM0
Unfortunately I can't customize the Octoprint port, so had to manually enter it into LulzBot Cura, but otherwise everything is working awesome!Hi Guys so basically I am a bit lost here... octoprint itself is running in my docker on my DSM. i connected the printer Anycubic 4Max Pro to the front port and to the back one. When turning Serial and Baud to automatic i get the error offline no more candidates to test indicating the applications has not found my printer. when Shh into my dsm i can find the usb device Silicon Labs CP2102N USB to UART Bridge Controller.
in Octoprint i have the options for ttyS0 -S3 i have edited these directories as well as tried other names like USB3 with chmod but could not get it to work. what am i doing wrong? BR
Hey, first you need to determine what the interface is on the Synology.
- Optionally boot the Synology with nothing connected to any USB port.
- Login via SSH and do
ls /dev | grep tty
- Plugin the USB with printer powered on and do
ls /dev | grep tty
once more. - There should be a new interface, find something that looks like
/dev/ttyACM0
or/dev/ttyUSB0
- Use this interface in the steps from @s1mb1o
Has anyone got a work around for DSM 7, which currently does not include support for /dev/ttyACM0
or /dev/ttyUSB0
via docker? If not I'd advice folks to stay on DSM 6 for now.
Has anyone got a work around for DSM 7, which currently does not include support for
/dev/ttyACM0
or/dev/ttyUSB0
via docker? If not I'd advice folks to stay on DSM 6 for now.
I am working on the same issue... Cannot get the /dev/ttyUSB0 forwarded to docker via the method described above.. I did get the serial USB driver from Jadahl working, but there it stops. Any time I try to upload a new settings .json file, the 'devices' section is ignored.. Wish I'd stayed at DSM6 :( If anyone finds a solution, very keen to hear it!
@piano-thomas FWIW I did get it forwarded, using Portainer ~~, and it discovers the device and attempts to connect but fails. I feel like DSM 7 is EOL for Octoprint unless something else comes out to try.~~
Edit: These steps do work, as long as you first do: https://github.com/robertklep/dsm7-usb-serial-drivers
To get this far, I did these steps:
- Install missing USB drivers using steps at: https://github.com/robertklep/dsm7-usb-serial-drivers
- Plug in and power on 3D printer. Discover interface by browsing
/dev/tty*
and enable permissions with:chmod a+rw /dev/ttyACM0
- Set up Octoprint in Docker w/out devices configured properly.
- Setup Portainer in Docker.
- Use Portainer to view Octoprint container, click 'Duplicate/Edit' and for the new container add the device mapping under 'Runtime & Resources'. Above the 'Advanced container settings' choose 'Deploy the container' and overwrite the original.
- Start Octoprint ~~, see the interface appear, try to connect – Fail.~~
Hey all, I managed to get it working by following the steps here: https://github.com/robertklep/dsm7-usb-serial-drivers
@piano-thomas FWIW I did get it forwarded, using Portainer, and it discovers the device and attempts to connect but fails. I feel like DSM 7 is EOL for Octoprint unless something else comes out to try.
To get this far, I did these steps:
- Setup Task Scheduler On Boot task to run as root:
/sbin/modprobe usbserial /sbin/modprobe ftdi_sio /sbin/modprobe cdc-acm insmod /lib/modules/usbserial.ko insmod /lib/modules/ftdi_sio.ko insmod /lib/modules/cdc_acm.ko chmod 777 /lib/modules/usbserial.ko chmod 777 /lib/modules/ftdi_sio.ko chmod 777 /lib/modules/cdc-acm.ko
- Plug in and power on 3D printer. Discover interface by browsing
/dev/tty*
and enable permissions with:chmod a+rw /dev/ttyACM0
- Set up Octoprint in Docker w/out devices configured properly.
- Setup Portainer in Docker.
- Use Portainer to view Octoprint container, click 'Duplicate/Edit' and for the new container add the device mapping under 'Runtime & Resources'. Above the 'Advanced container settings' choose 'Deploy the container' and overwrite the original.
- Start Octoprint, see the interface appear, try to connect – Fail.
I did get the dsm7 drivers to work using the steps described by @robertklep, however the forwarding is still a mystery to me :(.
@epheterson I just got octoprint working with DSM7 and docker container! Using container in privilege mode was the clue. Somehow the docker container couldn't access the /dev folder and detect the printer. If your printer is visible in the /dev list you should be able to run octoprint in docker with privilege mode and use it without Portainer.
@epheterson I just got octoprint working with DSM7 and docker container! Using container in privilege mode was the clue. Somehow the docker container couldn't access the /dev folder and detect the printer. If your printer is visible in the /dev list you should be able to run octoprint in docker with privilege mode and use it without Portainer.
Is there anyway I can do this without running my container in privilege mode? Really would like to know how I can access /dev without having to run in privilege mode
@harry71019 if you pass the specific device file(s) to the container (--device=/dev/foo:/dev/foo
) you don't need privileged mode, but if I understand correctly (not a user), octoprint may require full access to /dev
and not just to specific files.
@epheterson I just got octoprint working with DSM7 and docker container! Using container in privilege mode was the clue. Somehow the docker container couldn't access the /dev folder and detect the printer. If your printer is visible in the /dev list you should be able to run octoprint in docker with privilege mode and use it without Portainer.
Is there anyway I can do this without running my container in privilege mode? Really would like to know how I can access /dev without having to run in privilege mode
I can confirm my setup does not have privileged mode enabled, and Octoprint is working fine. You will have to manually forward the device like I mentioned in my earlier post, or when creating the container as @robertklep mentioned.
@epheterson @robertklep Thank you for both of your replies. Do you know how I can pass the --device using the docker GUI in DSM? Or am I better off with setting up portainer and creating a new container and passing the devices in.
@epheterson @robertklep Thank you for both of your replies. Do you know how I can pass the --device using the docker GUI in DSM? Or am I better off with setting up portainer and creating a new container and passing the devices in.
It's not possible to pass these devices with DSM UI, I suspect the UI is intentionally limited / simplified. You can avoid Portainer by creating your Docker container via CLI using the --device argument, or you can install Portainer and adjust settings on an existing (or new) container.
Thank you for your clarification, I guess I'll look into portainer and set it up.