docker-octoprint
docker-octoprint copied to clipboard
Dockerfile to set up Octoprint with x86, armv6, armv7 and arm64 support!
OctoPrint
This is a Dockerfile to set up OctoPrint. It supports the following architectures automatically:
- x86
- arm32v6 1
- arm32v7
- arm64
Just run:
docker run nunofgs/octoprint
Now have a beer, you did it. 🍻
Tags
1.4.0,1.4.0-debian,debian,latest(Dockerfile)1.4.0-alpine,alpine(Dockerfile)1.3.12,1.3.12-debian(Dockerfile)1.3.12-alpine(Dockerfile)1.3.11,1.3.11-debian(Dockerfile)1.3.11-alpine(Dockerfile)1.3.10(Dockerfile)1.3.9(Dockerfile)1.3.8(Dockerfile)1.3.7(Dockerfile)1.3.6(Dockerfile)master-debian,master(Automatically built daily from OctoPrint'smasterbranch)master-alpine(Automatically built daily from OctoPrint'smasterbranch)
Tested devices
| Device | Working? |
|---|---|
| Raspberry Pi 2b | ✅ |
| Raspberry Pi 3b+ | ✅ |
| Raspberry Pi Zero W | ✅ |
Please let me know if you test any others, would love to increase the compatibility list!
Usage
$ docker run \
--device=/dev/video0 \
-p 80:80 \
-v /mnt/data:/data \
nunofgs/octoprint
Environment Variables
| Variable | Description | Default Value |
|---|---|---|
| CAMERA_DEV | The camera device node | /dev/video0 |
| MJPEG_STREAMER_AUTOSTART | Start the camera automatically | true |
| MJPEG_STREAMER_INPUT | Flags to pass to mjpg_streamer | -y -n -r 640x480 |
CuraEngine integration
Cura engine integration was very outdated (using version 15.04.6) and was removed.
It will return once OctoPrint supports python3 (needed for the newest versions of cura engine).
Webcam integration
USB Webcam
- Bind the camera to the docker using --device=/dev/video0:/dev/videoX
- Optionally, change
MJPEG_STREAMER_INPUTto your preferred settings (ex:input_uvc.so -y -n -r 1280x720 -f 10)
Raspberry Pi camera module
- The camera module must be activated (sudo raspi-config -> interfacing -> Camera -> set it to YES)
- Memory split must be at least 128mb, 256mb recommended. (sudo raspi-config -> Advanced Options -> Memory Split -> set it to 128 or 256)
- You must allow access to device: /dev/vchiq
- Change
MJPEG_STREAMER_INPUTto use input_raspicam.so (ex:input_raspicam.so -fps 25)
* Raspberry PI camera support is only available in arm/v6 and arm/v7 builds at the moment.
Octoprint configuration
Use the following settings in octoprint:
webcam:
stream: /webcam/?action=stream
snapshot: http://127.0.0.1:8080/?action=snapshot
ffmpeg: /usr/bin/ffmpeg
Notes
Distro variants
There are currently alpine and debian variants available of this image. At time of writing, here are their sizes:
| Variant | Size |
|---|---|
| 1.3.11-alpine | 474MB |
| 1.3.11-debian | 889MB |
While SD cards are pretty cheap these days, a smaller image is always preferrable so feel free to submit PRs that reduce the image size without affecting functionality!
ARMv6 Docker Bug
ARM32v6 devices such as the Raspberry Pi Zero (W) are unfortunately unable to pull this image directly using docker pull nunofgs/octoprint due to a bug in Docker (moby/moby#37647, moby/moby#34875). There's a PR open to fix this but it might be some time until it hits a stable Docker release.
Until then, you can run this container by specifying the armv6 image hash. Example on HypriotOS 1.11.0:
$ docker manifest inspect nunofgs/octoprint | grep -e "variant.*v6" -B 4
# copy sha256 hash of the v6 image you want to run.
$ docker run nunofgs/octoprint@sha256:dce9b67ccd25bb63c3024ab96c55428281d8c3955c95c7b5133807133863da29
Toggle the camera on/off
This image uses supervisord in order to launch 3 processes: haproxy, octoprint and mjpeg-streamer.
This means you can disable/enable the camera at will from within octoprint by editing your config.yaml:
system:
actions:
- action: streamon
command: supervisorctl start mjpeg-streamer
confirm: false
name: Start webcam
- action: streamoff
command: supervisorctl stop mjpeg-streamer
confirm: false
name: Stop webcam
Credits
Original credits go to https://bitbucket.org/a2z-team/docker-octoprint. I initially ported this to the raspberry pi 2 and later moved to a multiarch image.
License
MIT