Example of running multiple instances of octoprint on ubuntu with docker and using usb cameras


I finally made my setup working (not exactly as perfect as I want, but I have a working setup now).

Context :

I didn't wanted to buy a raspi + cam for every printer I own (currently 4) and I had a spare old computer (gigabyte brix nuc-like computer with celeron J1900), so I went to try a setup using it with ubuntu 20.04.2 server and docker environment as I like experimenting.

My idea was to use a powered usb hub and usb cameras, then plug the printer + cameras and have a basic docker server running octoprint/octoprint instances. So basically if I need to have a new printer, I just need to add a container and plug them (printer + associated cam).

I faced a few issues that i managed to solve :

  • get a static link in /dev for usb hub port number as ttyUSB* and video* are numbered randomly (on power on order), this was solved by writing udev rules.
  • make cheap usb cameras from china works (I partially managed to do it by doing an ugly patch of the kernel I found on the net to prevent those cameras to take all the available bandwith of the usb bus, actually I have a $7 model working (MJPG+YUV), but I will try the $3 model (YUV) to make it work, actually i does not.). If this patch is not applied, only one camera will work on a given usb bus.

Some goodies I found nice is to add a docker postgres container to use the plugin filament manager and share the spools on the printer farm.

Ultimately I will try to find a way to use PSU Control plugin on this setup, as I want to do it cheap, it may be with a homemade smart plug, but it's not yet on the way.

There are probably lots of possibilities for this setup for those who know docker and octoprint. So If you are interested and want to have a look, I uploaded the draft of my project on github, I called it octobrix (from octoprint and the gigabyte brix I used to experiment).

Olivier. (sorry for my english, i'm french :slight_smile: )

Check the end of the post for some new informations.

[EDIT 18/07/2021] : I'm still not able to make the cheap $3 (and YUV only) usb cam to works, but I've found a $5 MJPEG camera on aliexpress, reducing the costs. Here is a pic and specs from it (I ordered one and confirm it works on my setup, I also designed a 3d printable case to attach it on 2020 tubes) :


This looks awesome - I'll try to install it this weekend and we'll see where I end up. I was trying to do this for forever and couldn't get it to work - Thanks so much!

You could take advantage of the automatic serial number/udev detection in my scripts here: GitHub - paukstelis/octoprint_deploy: Bash script for rapid deployment of multiple octoprint instance on a single machine

Hello Dennis,

Don't hesitate to give feedback on the issues (other than the outrageous kernel compile time to apply the patch ... I know that and I wish a kernel compilation expert could explain me why my method does not just recompile the uvcvideo part). As far I know you will be the first to have a try.


Hello, Thanks for the information, I will have a check if it can help in my setup.