Control a 3D printer with Raspberry, Docker, OctoPi and Motioneye


Last Updated on 15th September 2020 by peppe8o

Anet a6 3d printer desktop

One of most interesting uses of Raspberry PI is controlling a 3D printer (mine one is an Anet A6) without needing to be connected with your PC.

This can help for long prints and improve controls available on printer status.

It is also really useful in tuning operations, because it allows to easily control manually your printer motors, so getting fastly correct positioning to improve bed and extruder accessibility and levelling.

What Is OctoPi

OctoPi is a fork from Octoprint, built to run on Raspberry Pi.

OctoPrint is an Open Source project which enables an improved web interface to control 3D printer and printing jobs. It allows to:

  • Access the embedded webcam feed and watch remotely how your printer is creating your newest thing.
  • Get constant feedback regarding the current progress of your print job.
  • Take a look at the integrated GCODE visualizer to see a rendition of the GCODE you are currently printing.
  • Keep an eye on the temperatures of your hotends and print bed and adapt them on the fly.
  • Move the print head along all axes, extrude, retract or just define your own custom controls.
  • Start, stop or just pause your current print job, you are in full control at any time.

OctoPrint and Docker

Everyone knows my love for Docker. But in this case the official Docker image available on Docker Hub is not built on ARM processor, se there is the need to use an unofficial image.

From the various images that I tried, the one from urrizzz user ( was correctly working on my Raspberry Pi.

Some considerations on Hardware. OctoPrint notifies that the Raspberry Pi Zero W is not recommended since severe performance issues were observed, caused by the WiFi interface when bandwidth is utilized (look here for GitHub issue). So I decided to test it on my Raspberry Pi 3 Model A+, which has also a Raspberry PI camera connected that will be used for video streaming.

What We Need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if to continue with the project or remove them from the shopping cart. So, hardware will be only:

Step-by-Step Procedure

We start from a Raspbery PI with a light operating system installing Raspberry PI OS Lite. We’ll also need Docker installed (please follow Raspberry PI Docker installation procedure).

The following step is installing MotionEye into a container (also this can be done with the Raspberry PI Motioneye installation in Docker procedure, being careful to map also 8081 port for video streaming).

Before staring, we need to identify the port related to USB. Once your printer is powered on and connected with your Raspberry Pi, type:

ls /dev | grep tty

The port should sound something like /dev/ttyUSB0. Now the power of Docker comes to us and allows OctoPi installation with a single command line:

docker run -d --device /dev/ttyUSB0:/dev/ttyUSB0 -p 4000:5000 --name octopi urrizzz/octopi

Fantastic, isn’t it? Note that we had to change the host port (4000) in order to avoid port conflict with MotionEye

At the end of image download, extraction and run you will be able to connect your OctoPi setup wizard page by browsing the address http://<<YOUR_RPI_IP_ADDRESS>>:4000.

You can configure or simply press next (except for user and password creation) to reach the home page (all the settings can be edited later):


Click connect to contact your printer.

To connect also your webcam to OctoPi:

  • go to the settings (icon on top-right with the wrench),
  • select “Webcam and Timelapse”
  • insert your streaming IP address ( http://<<YOUR_RPI_IP_ADDRESS>>:8081/ ) and press the test button

My configuration appears as in the following picture:


Press “Save” and you should find your video streaming in Control Section:



How useful was this post?

Click on a star to rate it anonymously!

Average rating 4 / 5. Vote count: 4

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?