{"id":16963165,"url":"https://github.com/amedeebulle/octoprint-containers","last_synced_at":"2025-08-21T12:21:24.206Z","repository":{"id":56038337,"uuid":"134466774","full_name":"AmedeeBulle/octoprint-containers","owner":"AmedeeBulle","description":"Resin.io / Docker setup for OctoPrint on Raspberry Pi 3B/3B+","archived":false,"fork":false,"pushed_at":"2020-11-29T17:32:35.000Z","size":53,"stargazers_count":19,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T22:37:31.243Z","etag":null,"topics":["balena","docker","docker-compose","octoprint","raspberry-pi","raspberry-pi-3","resin-io"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AmedeeBulle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-22T19:38:12.000Z","updated_at":"2023-01-14T19:46:34.000Z","dependencies_parsed_at":"2022-08-15T12:00:32.398Z","dependency_job_id":null,"html_url":"https://github.com/AmedeeBulle/octoprint-containers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AmedeeBulle/octoprint-containers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmedeeBulle%2Foctoprint-containers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmedeeBulle%2Foctoprint-containers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmedeeBulle%2Foctoprint-containers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmedeeBulle%2Foctoprint-containers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AmedeeBulle","download_url":"https://codeload.github.com/AmedeeBulle/octoprint-containers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmedeeBulle%2Foctoprint-containers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266561387,"owners_count":23948632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["balena","docker","docker-compose","octoprint","raspberry-pi","raspberry-pi-3","resin-io"],"created_at":"2024-10-13T23:23:50.286Z","updated_at":"2025-07-22T19:34:30.646Z","avatar_url":"https://github.com/AmedeeBulle.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OctoPrint containers  [![Build Status](https://travis-ci.com/AmedeeBulle/octoprint-containers.svg?branch=master)](https://travis-ci.com/AmedeeBulle/octoprint-containers)\n\n# Contents\n\n\u003c!-- TOC START min:1 max:3 link:true update:false --\u003e\n- [Introduction](#introduction)\n- [Balena.io setup](#balenaio-setup)\n  - [Install BalenaOS on your Pi](#install-balenaos-on-your-pi)\n  - [Configure your OctoPrint device](#configure-your-octoprint-device)\n  - [Install the software on the Device](#install-the-software-on-the-device)\n- [Docker setup](#docker-setup)\n  - [Prepare the Raspberry Pi](#prepare-the-raspberry-pi)\n  - [Get the containers](#get-the-containers)\n    - [Option 1: Download the containers](#option-1-download-the-containers)\n    - [Option 2: Re-Build the containers](#option-2-re-build-the-containers)\n  - [Configure and run the OctoPrint server](#configure-and-run-the-octoprint-server)\n  - [Updates](#updates)\n- [First run](#first-run)\n- [Note about persistence](#note-about-persistence)\n- [Multiple printers](#multiple-printers)\n\n\u003c!-- TOC END --\u003e\n# Introduction\n\nThis is a Docker setup for [OctoPrint](https://octoprint.org/) on Raspberry Pi.  \nIt can be run with [balena.io](https://balena.io/) or as _Plain Docker_ on Raspbian.\n\nThe setup is made of 3 containers:\n\n- `octoprint`: runs the main [OctoPrint](https://octoprint.org/) application\n- `webcam`: runs the webcam streaming service (`mjpg-streamer`)\n- `haproxy`: exposes the above containers on http and https ports\n\nThe build will use by default the latest [OctoPrint](https://octoprint.org/) release, this can be overridden by changing the `release` argument in the `docker-compose.yml` file.\n\nThis setup will run on any Raspberry Pi, however [OctoPrint](https://octoprint.org/) recommends a Raspberry Pi 3 or 3+.\n\n# Balena.io setup\n\nAlthough it may seem complex at first, [balena.io](https://balena.io/) allows you to install and configure [OctoPrint](https://octoprint.org/) on a Pi in a few clicks.  \nAlso if you have multiple [OctoPrint](https://octoprint.org/) servers, they will be managed from a central place.\n\nFor additional help and nice screenshots of the [balena.io](https://balena.io/) interface look at [Get started with Raspberry Pi 3 and Python](https://docs.balena.io/learn/getting-started/raspberrypi3/python/) on the [balena.io](https://balena.io/) site.\n\n## Install BalenaOS on your Pi\n\n1. Create an account at [balena.io](https://balena.io/) and sign in\n1. Add your public SSH key to your [balena.io](https://balena.io/) profile\n1. On [balena.io](https://balena.io/), create an \"Application\" for managing your Pi.  \nChoose \"Raspberry Pi 3\" as Device Type.\n1. Add a Device to your Application.\n   - Configure WiFi here if your Pi is wireless.\n   - Download the BalenaOS image for your Pi.\n1. Follow the instructions to write the OS on your SD-Card and boot your Pi.  \nAfter a while your Pi will appear in your Application Dashboard.\n1. If you like you can change the name of your device.\n\n## Configure your OctoPrint device\n\nThe Environment Variables menu \"E(x)\" allows you to add variables to configure the device for your usage.\n\nYou can add the following variables:\n\nName         | Default                    | Description\n-------------|----------------------------|------------\nWEBCAM_START | `true`                     | Start the webcam streaming at boot time.\u003cbr\u003eUse false if you have no webcam or want to start it from the [OctoPrint](https://octoprint.org/) menu\nWEBCAM_INPUT | `input_raspicam.so -fps 5` | The input plugin for [`mjpg-streamer`](https://github.com/jacksonliam/mjpg-streamer).\u003cbr\u003eDefault is for the Raspberry Pi camera, see the documentation for others.\u003cbr\u003eExample for an USB webcam: `input_uvc.so -d /dev/video0 -r 640x480 -fps 5`.\n\n## Install the software on the Device\n\nThe device is now ready, we need to push the containers through [balena.io](https://balena.io/).  \nThe following commands need to be executed from the terminal on your local machine -- __not__ on the Raspberry Pi!  \n(On Windows, use [Git BASH](https://gitforwindows.org/) or something similar).\n\nClone this repository:\n\n```shell\ngit clone https://github.com/AmedeeBulle/octoprint-containers.git\ncd octoprint-containers/\n```\n\nAdd the address of your [balena.io](https://balena.io/) repository. This command is displayed in the top-left corner of your application dashboard on the web site and looks like:\n\n```shell\ngit remote add balena \u003cUSERNAME\u003e@git.balena.io:\u003cUSERNAME\u003e/\u003cAPPNAME\u003e.git\n```\n\nPush the code to [balena.io](https://balena.io/):\n\n```shell\ngit push balena master\n```\n\nThis will trigger a build on the [balena.io](https://balena.io/) servers. If all goes well it will finish with a nice unicorn \u0026#x1f984; ASCII art.  \nYour Raspberry Pi will download and run the containers automatically; after that your [OctoPrint](https://octoprint.org/) server will be ready to go!\n\nFor future updates, you simply need to pull the new code and push it back to [balena.io](https://balena.io/) and your device will be updated!\n\n```shell\ngit pull origin master\ngit push balena master\n```\n\n# Docker setup\n\nIf you do not want to use the [balena.io](https://balena.io/) services, you can run the exact same configuration directly on your Raspberry Pi.\n\n## Prepare the Raspberry Pi\n\nDownload and install [Raspbian Buster Lite](https://www.raspberrypi.org/downloads/raspbian/) to your Pi (Follow the instructions from the Foundation).  \nAlthough it will work with the full _Desktop_ environment, I strongly recommend the _Lite_ version.\n\nAs root, install `git`, `docker` and `docker-compose`:\n\n```shell\napt-get update\napt-get install git curl python-pip\ncurl -sSL https://get.docker.com | sh\npip install docker-compose\n```\n\nEnsure your linux user (`pi` or whatever you choose) is in the `docker` group:\n\n```shell\nusermod -a -G docker \u003cYourLinuxUser\u003e\n```\n\nAt this point you need to completely logout and re-login to activate the new group.\n\nFrom here, __you don't need root access anymore__.\n\nClone this repository:\n\n```shell\ngit clone https://github.com/AmedeeBulle/octoprint-containers.git\ncd octoprint-containers/\n```\n\n## Get the containers\n\nYou have 2 options here: download the pre-build containers or re-build them.\n\n### Option 1: Download the containers\n\nThis is the easiest and fastest way. The `pull` command will download the containers from the Docker Hub:\n\n```shell\ndocker-compose pull\n```\n\n__If you are not using a Raspberry Pi 3__: _multiarch_ build does not work properly on ARM variants (See Moby issue [34875](https://github.com/moby/moby/issues/34875)).  \nFor older Raspberry Pi you need to amend the _docker-compose_ files to pull the correct images:\n\n```shell\nsed -e 's/\\(image:.*\\)/\\1:arm32v6-latest/' -i.orig docker-compose.yml\n```\n\n### Option 2: Re-Build the containers\n\nIf for whatever reason you want to re-build the containers on your Pi, run:\n\n```shell\ndocker-compose build\n```\n\n__If you are not using a Raspberry Pi 3__: copy the `.env-distr` to `.env` and select you Raspberry Pi version.\n\n## Configure and run the OctoPrint server\n\nTo customize your setup, create a file named `.env` with the environment variables described in the [balena.io](https://balena.io/) section. You can use the file `.env-distr` as template.\n\n__Important__: in `docker-compose.yml` uncomment the following line:\n\n```yaml\n      - /run/dbus:/host/run/dbus\n```\n\nIf you don't do that, you won't be able to restart or shut down you Pi from the [OctoPrint](https://octoprint.org/) user interface.\n\nRun the [OctoPrint](https://octoprint.org/) server:\n\n```shell\ndocker-compose up\n```\n\nThis 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:\n\n```shell\ndocker-compose up -d\n```\n\nThis will keep he containers running, even after a reboot.\n\n## Updates\n\nTo update your setup with a newer version, get the latest code and containers and restart the service:\n\n```shell\ndocker-compose down\ngit pull origin master\ndocker-compose pull # or build\ndocker-compose up -d\n```\n\n# First run\n\nFor a _Plain Docker_ setup, you know the IP address of your Pi; if you run [balena.io](https://balena.io/), you will find the address in the application console.\n\nPoint your browser to the IP address of your Raspberry Pi and enjoy [OctoPrint](https://octoprint.org/)!\n\nAt 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...\n\nEnjoy!\n\n# Note about persistence\n\nAll 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.  \nIf you really need/want to destroy the volume and re-start from scratch:\n\n- [balena.io](https://balena.io/): select 'Purge Data' in the Device Menu\n- _Plain Docker_: run\n\n```shell\ndocker-compose down -v\n```\n\nThe 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:\n\n- [balena.io](https://balena.io/): click on the 'Restart' icon in the Device Dashboard\n- _Plain Docker_: run\n\n```shell\ndocker-compose down\ndocker-compose up -d\n```\n\nBy 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).\n\n# Multiple printers\n\nAlthough driving multiple printers from the same Raspberry Pi is possible, it might lead to performance issues. \nThis setup is nevertheless easy to achieve with the _plain Docker_ setup.  \nIt is a good solution if:\n\n- You have a powerful Raspberry Pi\n- You have multiple printers but use only one at a time\n\nYou can run any number of instances of this _container stack_ by using a different _project name_ and a different `.env` file.  \nThe `docker-compose-multi.sh` convenience script is provided to simplify operations.\n\nAssuming you already have a running instance, to add a new one simply copy the `.env-extra-distr` sample file to `.env-\u003cprinter name\u003e`,\nreview the configuration parameters and start the instance with `./docker-compose-multi.sh \u003cprinter name\u003e up -d`.\n\nMain points of attention:\n\n- Do not configure more than one Raspberry Pi camera!  \n  (There is no limitation on the number of USB cameras)\n- Ensure all instances have their own unique HTTP and HTTPS ports.\n\nSample session:\n\n```shell\n# Start the main instance\n$ docker-compose up -d\nCreating network \"octoprint_default\" with the default driver\nCreating octoprint_octoprint_1 ... done\nCreating octoprint_webcam_1    ... done\nCreating octoprint_haproxy_1   ... done\n$ docker-compose ps\n        Name                       Command               State                    Ports\n---------------------------------------------------------------------------------------------------------\noctoprint_haproxy_1     /usr/bin/entry.sh /opt/hap ...   Up      0.0.0.0:443-\u003e443/tcp, 0.0.0.0:80-\u003e80/tcp\noctoprint_octoprint_1   /usr/bin/entry.sh /opt/oct ...   Up      5000/tcp\noctoprint_webcam_1      /usr/bin/entry.sh /opt/web ...   Up      5200/tcp, 8080/tcp\n\n# Start an additional instance for the \"extra\" printer:\n$ cp .env-extra-distr .env-extra\n$ vi .env-extra\n$ ./docker-compose-multi.sh extra up -d\nCreating network \"extra_default\" with the default driver\nCreating volume \"extra_octoprint_vol\" with default driver\nCreating extra_webcam_1    ... done\nCreating extra_octoprint_1 ... done\nCreating extra_haproxy_1   ... done\n$ ./docker-compose-multi.sh extra ps\n      Name                     Command               State                      Ports\n--------------------------------------------------------------------------------------------------------\nextra_haproxy_1     /usr/bin/entry.sh /opt/hap ...   Up      0.0.0.0:8443-\u003e443/tcp, 0.0.0.0:8080-\u003e80/tcp\nextra_octoprint_1   /usr/bin/entry.sh /opt/oct ...   Up      5000/tcp\nextra_webcam_1      /usr/bin/entry.sh /opt/web ...   Up      5200/tcp, 8080/tcp\n```\n\nNotes:\n\n- As you can see in the above output, instances use a different network namespace as well as a different volume for storing data,\n  so they are completely separated and independent.\n- Depending on when your printers / cameras are detected they might get different device names on your Raspberry Pi...\n  Always check that you are driving the right printer!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famedeebulle%2Foctoprint-containers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famedeebulle%2Foctoprint-containers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famedeebulle%2Foctoprint-containers/lists"}