/klipper-web-control-docker

Klipper with Moonraker shipped with Fluidd and/or Mainsail

Primary LanguageDockerfileGNU General Public License v3.0GPL-3.0

Mainsail Multiarch Image CI Klipper Moonraker Multiarch Image CI

klipper-web-control-docker

Klipper with Moonraker shipped with Fluidd and/or Mainsail

  • get your printer to the next level!
  • Docker Compose config and Dockerfiles provided!
  • Build with Github actions and deployed to https://hub.docker.com/u/dimalo
  • Docker multiarch builds with best practices

Features

  • Dockerhub images support x64, ARM64, ARM32v7 & ARM32v6

  • Docker multistage builds for optimized image sizes

  • fully integrated klipper image with moonraker enabled

    • startup management with supervisord & dependent startup (klipper starts first, then only if klipper is running moonraker is started)
  • Optionally use the klipper_z_calibration-extension

  • collection of useful klipper macros see client_macros.cfg

    • Nozzle prime line with random Y starting point

      Don't use the same starting point for priming to reduce bed wear!

    • safe filament load / unload / change, which checks for sufficient (configurable) nozzle temperature

    • best practice start gcode:

      Please modify this to your needs! This macro works well on my cartesian and core xy machines and only homes Z as soon as the nozzle is hot, so leftover extrusions don't smash into the bed when they're cold.

      Example for PrusaSlicer start gcode:

      ; Making sure PrusaSlicer doesn't inject heatup gcode...
      M104 S0
      M190 S0
      ; Run START_PRINT macro
      START_PRINT T_BED=[first_layer_bed_temperature] T_EXTRUDER=[first_layer_temperature]
      
    • several versions of pause/cancel/end, to either present the toolhead or the print (and get the toolhead out of the way) - check the defaults!

    • park toolhead with M125 (default X25 Y0)

    • support delay with display output with COUNTDOWN

    Please be careful to not run the macros without making sure they work with your printer!

  • collection of calibration macros (for example manual bed leveling) see calibration_macros.cfg

  • complete Klipper setup with web control client

    • supports Fluidd
    • supports Mainsail
    • you can even run both in parallel!
  • only your printer.cfg is required

    • the services start without it, so you can supply your config through the web UI
    • you can mount your config file to /home/klippy/.config/printer.cfg, and klipper will pick it up after a restart

Getting started

Prerequisites:

  • Your klipper host machine runs Linux or MacOS (Windows was not tested yet)
    • (MacOS) Currently it is not possible to expose serial devices to a container in MacOS Docker. This is a known issue with Docker (docker/for-mac#900)
  • You have docker and docker-compose installed on your machine
  • You have flashed your printer with the appropriate .bin
  • You have your printer connected to your machine and you know it's serial mount point (e.g. /dev/ttyACM0 or /dev/ttyUSB0)
  • ARM32v6 (Raspberry Pi Zero and 1) requires Docker 20. Fluidd is not yet supported

Install the services

  1. clone this repository and open it or navigate to it in your terminal
  2. modify docker-compose.yml to your needs
    • set serial port of your printer
    • mount printer.cfg if already prepared (else you will be able to set it up later as well...)
  3. run docker-compose pull && docker-compose up if you want to use the provided dockerhub images, else run docker-compose up to first build them on your host
  4. watch the services being set up
    • make sure you have no port conflicts on 7125, 8010 and 8011
    • make sure klipper and moonraker started
    • leave the compose session running
  5. test the frontends
  6. configure your printer
    • modify / upload printer.cfg, if not mounted already
    • check if klipper is able to connect to the printer
    • follow klippers documentation to test your printers functionality

If things are running fine now...

Quit the compose session with Ctrl+Cand run docker-compose up -d.

Happy 3D Printing!

If things are not running...

No serial connection:

Check the permissions on the serial device in the klipper host.

ls -lsa /dev/ttyACM0

Supply the group permissions to the docker-compose config in docker-compose.yml build args for klipper.

Run docker-compose build

After build run docker-compose up -d and see if it works.

Klipper is crashing:

(from #25)

Klipper crashes with log similar to:

klipper Fatal Python error: pyinit_main: can't initialize time
klipper | Python runtime state: core initialized
klipper | PermissionError: [Errno 1] Operation not permitted

check your libseccomp version and update if needed (see https://docs.linuxserver.io/faq#libseccomp)

Features not implemented or not tested (yet)

  • compiling klipper.bin for your printer (will need compile tools which bloat the image so this will likely not be implemented)
  • automatic updates for klipper/moonraker (partly working as repos are getting updated but no dependency installs happen - update the container with docker-compose pull instead)
  • automatic updates for the frontend (update the container with docker-compose pull instead)
  • CI pipeline to build images as upstream repos change

Credits