Portainer Templates logo

Portainer Templates

OctoPrint OctoPrint

Container

OtherTools

OctoPrint is an open source 3D printer controller application, which provides a web interface for the connected printers.

Image details

Pulls: 15.2M
Architecture: amd64, arm64, arm/v7
Image size: 506 MB
Latest: 1.11.8
User: octoprint
Created: Feb 14, 2017
Updated: 1 month ago
Status: active

Source details

Stars: 9k
Forks: 2k
Language: Python
License: AGPL-3.0
Updated: 8 days ago
Website: octoprint.org/

Configuration

Type
Container
Platform
linux
Image
octoprint/octoprint:latest
Privileged
Yes
Ports
8051:80/tcp
Volumes
/octoprint : /portainer/Files/AppData/Config/OctoPrint/dev : /dev
Env vars
NODE_ENV=development ENABLE_MJPG_STREAMER=true
Restart
unless-stopped

Template by novaspirit

Notes

Template created by Pi-Hosted Series
Check our Github page: https://github.com/pi-hosted/pi-hosted

Official Webpage: https://octoprint.org/
Official Docker Documentation: https://hub.docker.com/r/octoprint/octoprint


Standalone Install

Select an install method, to see config/commands for deploying OctoPrint

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select OctoPrint, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo

More install options in our documentation, or see octoprint/octoprint for app-specific guidance.

OctoPrint-docker

This is the primary image of octoprint/octoprint. It is designed to work similarly, and support the same out of the box features as the octopi raspberry-pi machine image, using docker.
Tags

Table of Contents - Usage
- [Configuration](#configuration)
  - [Enabling Webcam Support with Docker](#enabling-webcam-support-with-docker)
  - [Webcam Setup in OctoPrint](#webcam-setup-in-octoprint)
  - [Container Environment based configs](#container-environment-based-configs)
  - [Editing Config files manually](#editing-config-files-manually)
- Without docker-compose - Building the image yourself

Usage

We recommend you use docker-compose to run octoprint via docker, and have included a recommended docker-compose.yml file for your convenience.
Save the contents of this file on your machine as docker-compose.yml, and then run docker-compose up -d.
Open octoprint at http://<octoprint_ip_or_url
See Initial Setup for configuration values to use during your fist launch of OctoPrint using docker.

Configuration

Enabling Webcam Support with Docker

In order to use the webcam, you'll need to make sure the webcam service is enabled. This is done by setting the environment variable ENABLE_MJPG_STREAMER=true in your docker run command, or in the docker-compose.yml file.
You'll also need to add --device /dev/video0:/dev/video0 to your docker run, or ensure it's listed in the devices array in your docker-compose.yml.
If you map a video device other than /dev/video0, you will additionally need to set an environment variable for CAMERA_DEV to match the mapped device mapping.
See container environment based configs for a full list of webcam configuration options configured with docker.

Webcam Setup in OctoPrint

Use the following values in the webcam & timelapse settings screen of the initial setup:
SettingValue
Stream URL/webcam/?action=stream
Snapshot URLhttp://localhost:8080/?action=snapshot
Path to FFMPEG/usr/bin/ffmpeg

Container Environment based configs

There are configuration values that you pass using container --environment options. Listed below are the options and their defaults. These are implicit in example docker-compose.yml, and if you wish to change them, refer to the docker-compose docs on setting environment variables.
variabledefault
CAMERADEV/dev/video0 (see note)
MJPGSTREAMERINPUT-y -n -r 640x480
ENABLEMJPGSTREAMERfalse

note: You will still need to declare the device mapping in your docker-compose file or docker command, even if you explicitly declare the CAMERA_DEV. The value of CAMERA_DEV is used in starting the mjpg-streamer service, whereas the devices mapping is used by docker to make sure the container has access to the device.
For example, if you change the CAMERA_DEV to be /dev/video1, you would also need to map /dev/video1:/dev/video1 in your container.

Editing Config files manually

This docker-compose file also contains a container based instance of vscode, accessible via your browser at the same url as your octoprint instance, allowing you to edit configuration files without needing to login to your octoprint host.
To make use of this editor, just uncomment the indicated lines in your docker-compose.yml then run the following commands:
docker-compose up -d config-editor

Now go to http://<octoprint_ip_or_url>:8443/?folder=/config in your browser to edit your octoprint files! Use the 'explorer' (accessible by clicking the hamburger menu icon) to explore folder and files to load into the editor workspace.
All configuration files are in the /config folder, and the active configuration will be accessible at /config/config.yaml
When you're done, we recommend you stop and remove this service/container:
docker-compose stop config-editor && docker-compose rm config-editor

For full documentation about the config editor, see the docs for the product at github.com/cdr/code-servercode-server.

Without docker-compose

If you prefer to run without docker-compose, first create an octoprint docker volume on the host, and then start your container:
docker volume create octoprint
docker run -d -v octoprint:/octoprint --device /dev/ttyACM0:/dev/ttyACM0 --device /dev/video0:/dev/video0 -e ENABLE_MJPG_STREAMER=true -p 80:80 --name octoprint octoprint/octoprint

Building the image yourself

If you would like to build the docker image yourself, please read CONTRIBUTING.md for details on how to do so.

Serve OctoPrint on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.

Proxying octoprint.example.com to http://octoprint:80

Add this to your Caddyfile

octoprint.example.com {
	reverse_proxy http://octoprint:80
}

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs octoprint
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Port already in use

If deployment fails with "Bind for 0.0.0.0:8051 failed: port is already allocated", something else on your server is using that port.

  • Find what's using it: sudo ss -tlnp | grep :8051
  • Stop the other service, or pick a different host port. In 8051:80 only the left number is yours to change, the right one belongs to the app.

Running but the page won't load

The container is up but nothing appears in your browser.

  • Use your server's real IP: http://your-server-ip:8051. The 0.0.0.0 link Portainer shows isn't a real address.
  • Give it a minute after first deploy, octoprint can take a while to initialise.
  • Make sure your firewall allows the port, e.g. sudo ufw allow 8051

Permission denied on volumes

If the logs show "permission denied", the app can't write to its data folder on the host.

  • Fix the ownership: sudo chown -R 1000:1000 /portainer/Files/AppData/Config/OctoPrint (and the same for the other mapped folders)

Image won't pull

Test the pull directly on the host: docker pull octoprint/octoprint:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64, arm64, arm/v7
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect octoprint --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Privileged mode

This template runs the container in privileged mode, giving it full access to your host.

  • Only deploy it if you trust the app.
  • If deployment is blocked, your Portainer security settings or hardened host may not allow privileged containers.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

A single container

OctoPrint runs as one container, the simplest kind of app here. Just the one image to pull and nothing else wired up alongside it.

The app image

An image is the app packed up ready to go, everything OctoPrint needs bundled into one download. This template pulls octoprint/octoprint:latest, which Docker fetches once (about 506 MB) and then starts your own copy from.

Where the image comes from

Docker pulls its images from registries, public libraries of ready-built apps. OctoPrint's comes from Docker Hub, published by octoprint.

Version tags

The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Newest right now is 1.11.8. Pin a specific tag if you would rather stay on one version.

Which machines it runs on

Every image is built for particular CPU types. This one ships for amd64, arm64, arm/v7, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.

Ports

A port is the door the app answers on. A mapping like 8051:80 means it's reachable on port 8051 of your server, where the left number is yours to change and the right one belongs to the app. Once it's running, open http://your-server-ip:8051 in a browser. It opens:

  • 8051:80, likely the web interface

Volumes

A volume is where OctoPrint keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:

  • /octoprint from /portainer/Files/AppData/Config/OctoPrint on the host
  • /dev from /dev on the host

Environment variables

Environment variables are the settings you hand over when you deploy, things like a password or a timezone. OctoPrint takes 2 of them, all with defaults you can leave alone or tweak:

  • NODE_ENV, defaults to development
  • ENABLE_MJPG_STREAMER, defaults to true

Restart policy

The restart policy here is unless-stopped, so Docker restarts OctoPrint after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).

Networking

Nothing custom is set, so OctoPrint sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.

Container name

Once it's deployed, Portainer names the container octoprint. That's what you'll spot in the containers list and use in commands like docker logs octoprint.

Privileged mode

This template runs OctoPrint in privileged mode, which gives it nearly as much access to your server as the system itself. Some apps genuinely need it to reach hardware or manage the host, so it's one to run only if you trust the source.

Platform

The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.

Open source license

OctoPrint is open source, released under the AGPL-3.0 license. In plain terms the code is out in the open, so you're free to run it and change it to fit what you need.

Portainer app templates

Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set OctoPrint up. Add the template list to Portainer once, then deploying OctoPrint is a click rather than a wall of config.