Docker Compose
Start Kestra with a Postgres database backend using a Docker Compose file.
The quickest way to a production-ready lightweight Kestra installation is to leverage Docker and Docker Compose. This guide will help you get started with Kestra using Docker.
Before you begin
Make sure you have already installed:
Download the Docker Compose file
Download the Docker Compose file using the following command:
curl -o docker-compose.yml \
https://raw.githubusercontent.com/kestra-io/kestra/develop/docker-compose.yml
If you don't have curl
installed, you can download the Docker Compose file manually and save it as docker-compose.yml
.
Launch Kestra
Use the following command to start the Kestra server:
docker-compose up -d
Open the URL http://localhost:8080
in your browser to launch the UI.
Adjusting the Configuration
The command above starts a standalone server (all architecture components in one JVM).
The configuration will be done inside the KESTRA_CONFIGURATION
environment variable of the Kestra container. You can update the environment variable inside the Docker compose file, or pass it via the Docker command line argument.
If you want to extend your Docker Compose file, modify container networking, or if you have any other issues using this Docker Compose file, check the Troubleshooting Guide.
Use a configuration file
If you want to use a configuration file instead of the KESTRA_CONFIGURATION
environment variable to configure Kestra you can update the default docker-compose.yml
.
First, create a configuration file containing the KESTRA_CONFIGURATION
environment variable defined in the docker-compose.yml
file. You can name it application.yaml
.
Then, update kestra
service in the docker-compose.yml
file to mount this file into the container and make Kestra using it via the --config
option:
# [...]
kestra:
image: kestra/kestra:latest-full
pull_policy: always
# Note that this is meant for development only. Refer to the documentation for production deployments of Kestra which runs without a root user.
user: "root"
command: server standalone --worker-thread=128 --config /etc/config/application.yaml
volumes:
- kestra-data:/app/storage
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/kestra-wd:/tmp/kestra-wd
- $PWD/application.yaml:/etc/config/application.yaml
ports:
- "8080:8080"
- "8081:8081"
depends_on:
postgres:
condition: service_started
Networking in Docker Compose
The default docker-compose file doesn't configure networking for the Kestra containers. This means that you won't be able to access any services exposed via localhost
on your local machine (e.g., another Docker container with a mapped port). Your machine and Docker container use a different network. To use a locally exposed service from Kestra container, you can use the host.docker.internal
hostname or 172.17.0.1
. The host.docker.internal
address allows you to reach your host machine's services from Kestra's container.
Alternatively, you can leverage Docker network. By default, your Kestra container will be placed in a default
network. You can add your custom services to the docker-compose.yml
file provided by Kestra and use the services' alias (keys from services
) to reach them. Even better would be if you create a new network e.g. network kestra_net
and add your services to it. Then you can add this network to the networks
section of the kestra
service. With this, you will have access via localhost
to all your exposed ports.
The example below shows how you can add iceberg-rest
, minio
and mc
(i.e. Minio client) to your Kestra Docker Compose file.
Finally, you can also use the host
network mode for the kestra
service. This will make your container use your host network and you will be able to reach all your exposed ports. This means you have to change the services.kestra.environment.KESTRA_CONFIGURATION.datasources.postgres.url
to jdbc:postgresql://localhost:5432/kestra
. This is the easiest way but it can be a security risk.
See the example below using network_mode: host
.
Was this page helpful?