You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to edit Kestra flows locally with Docker Compose
Answer
By default, Kestra stores its flow definitions in a database. This means that every time you edit a flow through the web UI, the source of truth lives inside the container, not in your repository. That is fine for quick experiments, but for a real project you want flows version-controlled alongside the rest of the code and editable with your favourite IDE.
The solution is a bind-mount combined with Kestra's built-in file watcher. The idea goes like this: you mount a host directory into the container and tell Kestra to watch it. Any YAML file you create or modify in that folder is automatically synced into Kestra's catalog.
1. Bind-mount your flows directory
In docker-compose.yml, add a volume entry that maps a local folder (here ./flows) to a path inside the container (here /flows):
The paths list must point to the container-side path — /flows in our case, not the host path.
3. Write your flows as local YAML files
Create any flow definition inside the ./flows directory on your host. For example, ./flows/main_dev.hello.yml:
id: hellonamespace: devtasks:
- id: say_hitype: io.kestra.plugin.core.log.Logmessage: "Hello from a local file!"
Note
Flows created locally must follow either the pattern [tenant]_[namespace].[flow].yml or [tenant]_[namespace]_[flow].yml.
As soon as you save the file, the watcher picks up the change and Kestra imports (or updates) the flow. You can verify it in the web UI at http://localhost:8080.
How the sync works
From Host to Kestra is automatic thanks to the watcher. Every time a YAML file is created or modified in the watched directory, Kestra upserts the corresponding flow.
From Kestra to Host does not happen. If you edit a flow through the web UI, the change is written to the database only; the YAML file on the host is not updated. To keep things consistent, treat the local files as the single source of truth and avoid editing flows in the UI.
Putting it all together
A minimal docker-compose.yml that includes everything discussed above:
Run docker compose up -d, drop a YAML flow into ./flows, and it will appear in Kestra within seconds, fully version-controlled and editable from your host machine.
Course
data-engineering-zoomcamp
Question
How to edit Kestra flows locally with Docker Compose
Answer
By default, Kestra stores its flow definitions in a database. This means that every time you edit a flow through the web UI, the source of truth lives inside the container, not in your repository. That is fine for quick experiments, but for a real project you want flows version-controlled alongside the rest of the code and editable with your favourite IDE.
The solution is a bind-mount combined with Kestra's built-in file watcher. The idea goes like this: you mount a host directory into the container and tell Kestra to watch it. Any YAML file you create or modify in that folder is automatically synced into Kestra's catalog.
1. Bind-mount your flows directory
In
docker-compose.yml, add a volume entry that maps a local folder (here./flows) to a path inside the container (here/flows):With this single line, anything you put in
./flowson the host appears at/flowsinside the container.2. Enable the file watcher
Kestra uses Micronaut under the hood. You can activate its file-system watcher through the
KESTRA_CONFIGURATIONenvironment variable:The
pathslist must point to the container-side path —/flowsin our case, not the host path.3. Write your flows as local YAML files
Create any flow definition inside the
./flowsdirectory on your host. For example,./flows/main_dev.hello.yml:Note
Flows created locally must follow either the pattern
[tenant]_[namespace].[flow].ymlor[tenant]_[namespace]_[flow].yml.As soon as you save the file, the watcher picks up the change and Kestra imports (or updates) the flow. You can verify it in the web UI at
http://localhost:8080.How the sync works
Putting it all together
A minimal
docker-compose.ymlthat includes everything discussed above:Run
docker compose up -d, drop a YAML flow into./flows, and it will appear in Kestra within seconds, fully version-controlled and editable from your host machine.For more information, check Kestra's official guide to sync local flows.
Checklist