Access Files on your Local Machine in Kestra
Access locally stored files on your machine inside Kestra workflows.
In Kestra, you can access files stored on your local machine from within your flows.
This is useful when you have a directory of files to process or scripts to execute without needing to copy them into Kestra.
Setting up Kestra with Docker
If you're running Kestra with Docker, you’ll need to create a bind mount to a local directory on your machine so that Kestra can access those files inside the container.
In your Docker Compose file, add the absolute path of the local directory and define its mount point inside the container.
In this example, the local path /Users/username/Documents/files is mounted to /files inside the container using - /Users/username/Documents/files:/files.
Add this under the volumes section of your Docker Compose file:
...
kestra:
image: kestra/kestra:latest
pull_policy: always
user: "root"
command: server standalone
volumes:
- kestra-data:/app/storage
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/kestra-wd:/tmp/kestra-wd
- /Users/username/Documents/files:/files
...
You can now access any files or directories within /Users/username/Documents/files from inside Kestra under the /files path.
Accessing files inside Script tasks
By default, a Script task runs inside a Docker Task Runner.
To access local files, change the Task Runner type to Process, so it runs as a subprocess on your Kestra instance:
id: process
namespace: company.team
tasks:
- id: hello
type: io.kestra.plugin.scripts.shell.Commands
taskRunner:
type: io.kestra.plugin.core.runner.Process
commands:
- cat /files/myfile.txt
Was this page helpful?