This is a Docker setup for [OctoPrint](https://octoprint.org/) and [klipper](https://github.com/KevinOConnor/klipper)
Go to file
default 902107221e Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
haproxy Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
klipper Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
octoprint Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
scripts Initial commit 2020-11-03 10:02:19 +00:00
tmp Initial commit 2020-11-03 10:02:19 +00:00
webcam Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
.env-distr Initial commit 2020-11-03 10:02:19 +00:00
.gitignore Initial commit 2020-11-03 10:02:19 +00:00
.travis.yml Initial commit 2020-11-03 10:02:19 +00:00
README.md Update README. 2020-11-03 10:36:43 +00:00
docker-compose.yml Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
docker-compose.yml-no-usb-without-resin Initial commit 2020-11-03 10:02:19 +00:00
gcode-offsets.txt Working klipper config, conflicting ownership of between klipper and octoprint containers.. 2021-01-21 13:57:28 +00:00
udevadm_info_USB0_GT2560.out Initial commit 2020-11-03 10:02:19 +00:00

README.md

OctoPrint containers

Contents

Introduction

This is a Docker setup for OctoPrint on Raspberry Pi.

The setup is made of 3 containers:

  • octoprint: runs the main OctoPrint application
  • klipper: runs the klipper application
  • webcam: runs the webcam streaming service (mjpg-streamer)
  • haproxy: exposes the above containers on http and https ports

The build will use by default the latest OctoPrint release, this can be overridden by changing the release argument in the docker-compose.yml file.

This setup will run on any Raspberry Pi, however OctoPrint recommends a Raspberry Pi 3 or 3+.

Configure your OctoPrint device

The Environment Variables menu "E(x)" allows you to add variables to configure the device for your usage.

You can add the following variables:

Name Default Description
WEBCAM_START true Start the webcam streaming at boot time.
Use false if you have no webcam or want to start it from the OctoPrint menu
WEBCAM_INPUT input_raspicam.so -fps 5 The input plugin for mjpg-streamer.
Default is for the Raspberry Pi camera, see the documentation for others.
Example for an USB webcam: input_uvc.so -d /dev/video0 -r 640x480 -fps 5.

Docker setup

Prepare the Raspberry Pi

Download and install Raspbian Stretch Lite to your Pi (Follow the instructions from the Foundation).
Although it will work with the full Desktop environment, I strongly recommend the Lite version.

As root, install git, docker and docker-compose:

# apt-get update
# apt-get install git curl python-pip
# curl -sSL https://get.docker.com | sh
# pip install docker-compose

Ensure your linux user (pi or whatever you choose) is in the docker group:

# usermod -a -G docker <YourLinuxUser>

At this point you need to completely logout and re-login to activate the new group.

From here, you don't need root access anymore.

Clone this repository:

$ git clone https://git.ring-zero.co.uk/docker/octoprint-containers.git
$ cd octoprint-containers/

Get the containers

You have 2 options here: download the pre-build containers or re-build them.

Option 1: Download the containers

This is the easiest and fastest way. The pull command will download the containers from the Docker Hub:

$ docker-compose pull

If you are not using a Raspberry Pi 3: multiarch build does not work properly on ARM variants (See https://github.com/moby/moby/issues/34875 ).
For older Raspberry Pi you need to amend the docker-compose files to pull the correct images:

$ sed -e 's/\(image:.*\)/\1:arm32v6-latest/' -i.orig docker-compose.yml

Option 2: Re-Build the containers

If for whatever reason you want to re-build the containers on your Pi, run:

$ docker-compose build

If you are not using a Raspberry Pi 3: copy the .env-distr to .env and select you Raspberry Pi version.

Configure and run the OctoPrint server

If you don't do that, you won't be able to restart or shut down you Pi from the OctoPrint user interface.

Run the OctoPrint server:

$ docker-compose up

This will start the containers and remain attached to your terminal. If everything looks good, you can cancel it and restart the service in detached mode:

$ docker-compose up -d

This will keep he containers running, even after a reboot.

Updates

To update your setup with a newer version, get the latest code and containers and restart the service:

$ docker-compose down
$ git pull origin master
$ docker-compose pull # or build
$ docker-compose up -d

First run

Point your browser to the IP address of your Raspberry Pi and enjoy OctoPrint!

At first run, the haproxy container will generate a self-signed SSL certificate, so the service will be available on both http and https ports. If you want to share your printer with the world, only expose the https port...

Enjoy!

Note about persistence

All working files (configuration, G-Code, time-lapses, ...) are stored in the octoprint_vol Docker volume, so they won't disappear unless you explicitly destroy the volume.

docker-compose down -v

The same applies to the containers themselves: they won't be destroyed by default even if you reboot the Pi. To remove existing container and re-create them:

docker-compose down
docker-compose up -d

By doing this, you will loose any change made to the code, in particular if you installed plugins you will have to re-install them (but their configuration will be preserved).