Sign inSign up

mkuf/moonraker

By mkuf

•Updated 17 days ago

Web API used to interact with the 3D printing firmware Klipper.

Image
1

100K+

mkuf/moonraker repository overview

This Image is built and used by prind⁠.

⁠Moonraker packaged in Docker

⁠What is Moonraker?

Moonraker is a Python 3 based web server that exposes APIs with which client applications may use to interact with the 3D printing firmware Klipper. Communcation between the Klippy host and Moonraker is done over a Unix Domain Socket. Tornado is used to provide Moonraker's server functionality.

via https://moonraker.readthedocs.io/en/latest/⁠

⁠Usage

Moonraker requires Klipper to operate. See the Images' README.md⁠ on how to run the Klipper Image.
Both Containers need to share their run Volume in order to be able to communicate via klippers unix socket. Configure Moonraker to use /opt/printer_data/run/klipper.sock as klippys uds address.

Create moonraker.conf and printer.cfg as well as the directories run and gcode, then run the containers.

⁠Run
docker run \
  --privileged \
  -v /dev:/dev \
  -v $(pwd)/run:/opt/printer_data/run \
  -v $(pwd)/gcode:/opt/printer_data/gcodes \
  -v $(pwd)/printer.cfg:/opt/printer_data/config/printer.cfg \
  mkuf/klipper:latest

docker run \
  -v $(pwd)/run:/opt/printer_data/run \
  -v $(pwd)/gcode:/opt/printer_data/gcodes \
  -v $(pwd)/moonraker.conf:/opt/printer_data/config/moonraker.conf \
  -p 7125:7125 \
  mkuf/moonraker:latest
⁠Compose
services:
  klipper:
    image: mkuf/klipper:latest
    privileged: true
    volumes:
      - /dev:/dev
      - ./printer.cfg:/opt/printer_data/conf/printer.cfg
      - ./run:/opt/printer_data/run
      - ./gcode:/opt/printer_data/gcodes

  moonraker:
    image: mkuf/moonraker:latest
    ports:
      - "7125:7125"
    volumes:
      - ./moonraker.conf:/opt/printer_data/conf/moonraker.conf
      - ./run:/opt/printer_data/run
      - ./gcode:/opt/printer_data/gcodes

⁠Defaults

EntityDescription
Usermoonraker (1000:1000)
Workdir/opt
Entrypoint/opt/venv/bin/python moonraker/moonraker/moonraker.py
Cmd-d /opt/printer_data/

⁠Ports

PortDescription
7125/tcpDefault Webapi Port

⁠Volumes

VolumeDescription
/opt/printer_data/runDefault Location for runtime Files generated by Klipper. Used to access klipper.sock, the unix socket that is used for communation with klipper
/opt/printer_data/configConfig directory to host moonraker.conf
/opt/printer_data/gcodesStores uploaded GCODE Files
/opt/printer_data/logsLog directory for Klipper and Moonraker

⁠Tags

TagDescriptionStatic
latestRefers to the most recent runtime Image.May point to a new build within 24h, depending on code changes in the upstream repository.
<git description>
eg: v0.8.0-314-gaadff0d
Refers to a specific git description⁠ in the upstream repository. eg: arksine/moonraker:v0.8.0-314-gaadff0d⁠Yes

⁠Targets

TargetDescriptionPushed
buildPull Upstream Codebase and build python venvNo
runDefault runtime ImageYes

⁠Healthcheck

/opt/health.sh gets executed every 5s inside the container.

Be aware that enabling health checks in docker may increase CPU usage drastically.
In tests, cpu usage of the container was doubled when executing the healtch check every 30s and increased sixfold when executing every 5s.
This may lead to resource shortages on low powered host and unwanted behaviour

The script does the following:

  • queries the /server/info endpoint of moonraker
  • Performs the following checks
    • Number of failed moonraker_components = 0
    • klippy_connected is true
    • klippy_state is ready
  • If one of the above requirements is not met, the script exits with a failure state to indicate the container is unhealthy

Compose example:

services:
  moonraker:
    healthcheck:
      test: ["bash", "/opt/health.sh"]
      interval: 30s

Tag summary

Content type

Image

Digest

sha256:c398e6e95…

Size

149.9 MB

Last updated

17 days ago

docker pull mkuf/moonraker