Kroki is an open-source, diagram-as-code service that provides a unified API to generate diagrams from plain text descriptions. It supports a wide range of diagram formats - including BlockDiag, PlantUML, Graphviz, and many others - allowing users to create flowcharts, sequence diagrams, network diagrams, and more without installing individual tools.
This tutorial explains how to install Kroki inside Docker container on Linux. Commands have been tested on Ubuntu.
Prepare environment
Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.
Install Kroki
- Host network
Run the following command to create a container for Kroki that uses host network:
docker run -d --name=kroki --restart=always --network=host \
yuzutech/kroki
- User-defined bridge network
User-defined bridge network can be used for listening on different port. By default, Kroki service is listening on port 80. It can be changed with -p
option.
docker network create app-net
docker run -d --name=kroki --restart=always --network=app-net \
-p 8080:8000 \
yuzutech/kroki
Testing Kroki
In this example, we test the Kroki server using the Graphviz format. By sending a simple diagram description using the curl
command, we can generate and save an SVG file directly from the command line:
curl -sSo diagram.svg http://192.168.0.227:8000/graphviz/svg --data-raw 'digraph G {Hello->World}'
Note: Replace the IP address with the actual IP address of the system.
Uninstall Kroki
To completely remove Kroki, remove its container:
docker rm --force kroki
Remove Kroki image:
docker rmi yuzutech/kroki
If a user-defined bridge network was created, you can delete it as follows:
docker network rm app-net
Leave a Comment
Cancel reply