Files
prind/docker/klipper
Markus Küffner 14b89b0b0b support klipper input-shaper
* adds numpy to klipper runtime image
  * adds numpy and matplotlib to mcu image
  * add docker-compose.calibrate-shaper.yaml to simplify data processing
  * updates docs
2022-07-08 16:30:23 +02:00
..
2022-07-08 16:30:23 +02:00

Klipper packaged in Docker

What is Klipper?

Klipper is a 3d-Printer firmware. It combines the power of a general purpose computer with one or more micro-controllers. See the features document for more information on why you should use Klipper.

via https://www.klipper3d.org/

Usage

As Klipper is hardware dependent, there are considerations to make before deciding how to run the Container.

Standalone

If you intend to use Klipper in a Standalone configuration or with a GCODE-Sender that is dependent on a Serial connection (like Octoprint), it is necessary to start the container in privileged mode and allow access to /dev. Otherwise it would not be possible to use the emulated serial interface that is generated by klippy.
Point your GCODE-Sender to klipper.tty within the run directory.

Run

Create a configfile printer.cfg and a directory run and execute:

docker run \
  --privileged \
  -v /dev:/dev \
  -v $(pwd)/run:/ \
  -v $(pwd)/printer.cfg:/opt/cfg/printer.cfg \
  mkuf/klipper:latest

Compose

services:
  klipper:
    image: mkuf/klipper:latest
    privileged: true
    volumes:
      - /dev:/dev
      - ./printer.cfg:/opt/cfg/printer.cfg
      - ./run:/opt/run

With Moonraker

If you intend to use Klipper together with Moonraker, both Containers can be started in unprivileged mode.
As communication between both services is handled via a unix socket, they need to share a common directory in which the socket may be located.
To limit klippers access to system devices (/dev), the printers physical serial port is linked into the container. In this example, the printers serial port is /dev/ttymc3.

Further Info on how to use the Moonraker Image can be found in its README.md

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

Run

docker run \
  --device /dev/ttymxc3:/dev/ttymxc3 \
  -v $(pwd)/run:/ \
  -v $(pwd)/gcode:/opt/gcode \
  -v $(pwd)/printer.cfg:/opt/cfg/printer.cfg \
  mkuf/klipper:latest

docker run \
  -v $(pwd)/run:/ \
  -v $(pwd)/gcode:/opt/gcode \
  -v $(pwd)/moonraker.cfg:/opt/cfg/moonraker.cfg \
  -p 7125:7125 \
  mkuf/moonraker:latest

Compose

services:
  klipper:
    image: mkuf/klipper:latest
    devices:
      - /dev/ttymxc3:/dev/ttymxc3
    volumes:
      - ./printer.cfg:/opt/cfg/printer.cfg
      - ./run:/opt/run
      - ./gcode:/opt/gcode

  moonraker:
    image: mkuf/moonraker:latest
    ports:
      - "7125:7125"
    volumes:
      - ./moonraker.cfg:/opt/cfg/moonraker.cfg
      - ./run:/opt/run
      - ./gcode:/opt/gcode

Defaults

Entity Description
User klipper (1000:1000)
Workdir /opt
Entrypoint /opt/venv/bin/python klipper/klipper/klippy.py
Cmd -I run/klipper.tty -a run/klipper.sock cfg/printer.cfg

Ports

none

Volumes

Volume Description
/opt/run Default Location for runtime Files generated by Klipper.
Namely klipper.tty, the emulated Serial device
and klipper.sock, the unix socket that is used for communation with moonraker
/opt/cfg Config directory to host printer.cfg
/opt/gcode Stores GCODE Files to be used by Klipper

Tags

Tag Description Static
latest/nightly Refers to the most recent runtime Image. May point to a new build within 24h, depending on code changes in the upstream repository.
<7-digit-sha>
eg: d75154d
Refers to a specific commit SHA in the upstream repository. eg: Klipper3d/klipper:d75154d Yes
*-mcu Refers to a full blown Ubuntu Image containing all Tools necessary to Build the Microcontroller code for Klipper Yes

Targets

Target Description Pushed
build Pull Upstream Codebase and build python venv No
build-simulavr Based on mcu: Pull and Build simulavr for klipper. Used for testing without Hardware. No
run Default runtime Image Yes
mcu Build Tools for MCU code compilation Yes