Bind Mount
Use bind-mount to execute locally stored scripts.
To run a script stored locally, you can bind-mount it to your Kestra container.
Bind-mounting local scripts
Bind-mounting local scripts to the Kestra server can also make the local scripts available to the Docker containers running the script tasks. This is useful when you want to test a script and you donβt want to use Namespace Files.
First, make sure that your Kestra configuration in the Docker Compose file allows volume mounting. Below is an example with the intended setting in the final line:
kestra: image: kestra/kestra:latest pull_policy: always user: "root" env_file: - .env command: server standalone --worker-thread=128 volumes: - kestra-data:/app/storage - /var/run/docker.sock:/var/run/docker.sock - /tmp/kestra-wd:/tmp/kestra-wd:rw environment: KESTRA_CONFIGURATION: | datasources: postgres: url: jdbc:postgresql://postgres:5432/kestra driver-class-name: org.postgresql.Driver username: kestra password: k3str4 kestra: server: basic-auth: enabled: false username: "admin@kestra.io" # it must be a valid email address password: kestra repository: type: postgres storage: type: local local: base-path: "/app/storage" queue: type: postgres tasks: tmp-dir: path: /tmp/kestra-wd/tmp plugins: configurations: - type: io.kestra.plugin.scripts.runner.docker.Docker values: volume-enabled: true # π this is the relevant setting
With that setting, you can point the script task to any script on your local file system:
id: pythonVolumenamespace: company.teamtasks: - id: anyPythonScript type: io.kestra.plugin.scripts.python.Commands containerImage: ghcr.io/kestra-io/pydata:latest taskRunner: type: io.kestra.plugin.scripts.runner.docker.Docker volumes: - /Users/anna/gh/KESTRA_REPOS/scripts:/app commands: - python /app/etl/parametrized.py
This flow points the Python task running in a Docker container to this ETL script.