> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/references/october2026/engine-guide/spark-1/local-development.md).

# Local Spark development

Run Vulcan locally with Docker, Spark, Iceberg REST, RustFS, and PostgreSQL.

Follow these steps to create a local Spark environment. Vulcan runs inside Docker, so Java and Python are not required on the host.

## Prerequisites

Install Docker and Git. Confirm that Docker is running:

```bash
docker --version
docker compose version
docker info
git --version
```

You also need:

* The latest Vulcan `.whl` file.
* Access to the `tmdcio/vulcan-spark-base` image.
* At least 8 GB of memory available to Docker.

The Spark image uses `linux/amd64`. Docker Desktop runs it through emulation on Apple Silicon.

## Step 1: Create the project folder

Create the project structure:

```bash
mkdir spark-local
cd spark-local
mkdir -p docker dependencies/java
```

Check whether the current folder already contains a Vulcan wheel:

```bash
ls -1 vulcan-*.whl
```

If the command does not show the latest wheel, copy it into the current folder:

```bash
cp /path/to/vulcan-<version>-py3-none-any.whl .
```

Keep only the wheel version you want to run. The project should now contain:

```
spark-local/
├── docker/
├── dependencies/
│   └── java/
└── vulcan-<version>-py3-none-any.whl
```

Create `.env` and set the same version as the wheel:

```bash
cat > .env <<'EOF'
VULCAN_VERSION=<version>
EOF

ln -s ../.env docker/.env
```

For example, `vulcan-0.228.1.32-py3-none-any.whl` requires:

```
VULCAN_VERSION=0.228.1.32
```

## Step 2: Add the Docker Compose file

Create `docker/docker-compose.yml` and paste the following configuration:

```yaml
name: ldk

x-images:
  postgres: &postgres_image "postgres:15-alpine"
  rustfs: &rustfs_image "rustfs/rustfs:1.0.0"
  iceberg-rest: &iceberg_rest_image "tabulario/iceberg-rest:1.6.0"
  spark: &spark_image "tmdcio/vulcan-spark-base:${VULCAN_VERSION}"

volumes:
  statestore:
  rustfs-warehouse-data:
  vulcan-cli-venv:

networks:
  net:
    driver: bridge

services:
  statestore:
    image: *postgres_image
    container_name: ldk-statestore
    environment:
      POSTGRES_DB: statestore
      POSTGRES_USER: vulcan
      POSTGRES_PASSWORD: vulcan
      POSTGRES_HOST_AUTH_METHOD: trust
    ports:
      - "5431:5432"
    volumes:
      - statestore:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U vulcan -d statestore"]
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - net

  rustfs-warehouse:
    image: *rustfs_image
    container_name: ldk-rustfs
    environment:
      RUSTFS_ACCESS_KEY: admin
      RUSTFS_SECRET_KEY: password
      RUSTFS_OBS_LOG_STDOUT_ENABLED: "true"
      RUSTFS_SERVER_DOMAINS: rustfs-warehouse
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - rustfs-warehouse-data:/data
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:9000/health/ready"]
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - net

  create-bucket:
    image: *rustfs_image
    container_name: ldk-create-bucket
    depends_on:
      rustfs-warehouse:
        condition: service_healthy
    entrypoint: /bin/sh
    command:
      - -c
      - >-
        curl -sf -o /dev/null --aws-sigv4 aws:amz:us-east-1:s3
        --user admin:password
        --head http://rustfs-warehouse:9000/warehouse ||
        curl -sSf --aws-sigv4 aws:amz:us-east-1:s3
        --user admin:password
        -X PUT http://rustfs-warehouse:9000/warehouse
    restart: "no"
    networks:
      - net

  iceberg-rest-warehouse:
    image: *iceberg_rest_image
    container_name: ldk-iceberg-rest
    environment:
      CATALOG_WAREHOUSE: s3://warehouse/
      CATALOG_IO__IMPL: org.apache.iceberg.aws.s3.S3FileIO
      CATALOG_S3_ENDPOINT: http://rustfs-warehouse:9000
      CATALOG_S3_ACCESS__KEY__ID: admin
      CATALOG_S3_SECRET__ACCESS__KEY: password
      CATALOG_S3_PATH__STYLE__ACCESS: "true"
      AWS_REGION: us-east-1
      AWS_DEFAULT_REGION: us-east-1
    ports:
      - "8181:8181"
    depends_on:
      create-bucket:
        condition: service_completed_successfully
    networks:
      - net

  driver-jars:
    image: *spark_image
    platform: linux/amd64
    container_name: ldk-driver-jars
    entrypoint:
      - sh
      - -c
      - >-
        rm -f /driver-jars/*.jar &&
        cp /opt/spark/jars/*.jar /driver-jars/ &&
        echo "driver JARs ready: $$(ls /driver-jars/*.jar | wc -l)"
    volumes:
      - ${HOME}/.cache/vulcan/spark-jars/${VULCAN_VERSION}:/driver-jars
    restart: "no"
    networks:
      - net

  spark-master:
    image: *spark_image
    platform: linux/amd64
    container_name: ldk-spark-master
    depends_on:
      driver-jars:
        condition: service_completed_successfully
    command: >
      /opt/spark/bin/spark-class org.apache.spark.deploy.master.Master
    environment:
      SPARK_MASTER_HOST: spark-master
      SPARK_MASTER_PORT: 7077
      SPARK_MASTER_WEBUI_PORT: 8080
    ports:
      - "7077:7077"
      - "8080:8080"
    networks:
      net:
        aliases:
          - spark-master

  spark-worker-1: &spark_worker
    image: *spark_image
    platform: linux/amd64
    container_name: ldk-spark-worker-1
    depends_on:
      - spark-master
    environment:
      SPARK_WORKER_CORES: 4
      SPARK_WORKER_MEMORY: 2g
    command: >
      /opt/spark/bin/spark-class org.apache.spark.deploy.worker.Worker
      spark://spark-master:7077
    volumes:
      - ../dependencies/java:/etc/dataos/work/dependencies/java:ro
    networks:
      - net

  spark-worker-2:
    <<: *spark_worker
    container_name: ldk-spark-worker-2

  vulcan-cli:
    build:
      dockerfile_inline: |
        FROM python:3.13-bookworm
        RUN apt-get update \
         && apt-get install -y --no-install-recommends openjdk-17-jre-headless procps \
         && rm -rf /var/lib/apt/lists/*
    image: ldk-vulcan-cli:py3.13
    pull_policy: build
    container_name: ldk-vulcan-cli
    restart: "no"
    depends_on:
      driver-jars:
        condition: service_completed_successfully
      spark-master:
        condition: service_started
      iceberg-rest-warehouse:
        condition: service_started
      statestore:
        condition: service_healthy
    environment:
      VULCAN_VERSION: ${VULCAN_VERSION}
      STATESTORE_HOST: statestore
      STATESTORE_PORT: "5432"
      LOCAL_DEV_HOST: vulcan-cli
      PATH: /opt/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    volumes:
      - ..:/workspace
      - ${HOME}/.cache/vulcan/spark-jars:/root/.cache/vulcan/spark-jars:ro
      - vulcan-cli-venv:/opt/venv
    ports:
      - "4040:4040"
    working_dir: /workspace
    networks:
      net:
        aliases:
          - vulcan-cli
    command:
      - sh
      - -c
      - |
        set -eu
        mkdir -p /tmp/iceberg
        WHEEL=/workspace/vulcan-$${VULCAN_VERSION}-py3-none-any.whl
        if [ ! -f "$$WHEEL" ]; then
          echo "ERROR: $$WHEEL not found"
          exit 1
        fi
        [ -x /opt/venv/bin/python ] || python -m venv /opt/venv
        if [ "$$(vulcan --version 2>/dev/null || true)" != "$${VULCAN_VERSION}" ]; then
          /opt/venv/bin/pip install -q --upgrade pip
          /opt/venv/bin/pip install --use-deprecated=legacy-resolver \
            "vulcan[spark,postgres] @ file://$$WHEEL"
        fi
        /opt/venv/bin/python -c "import setuptools" 2>/dev/null ||
          /opt/venv/bin/pip install -q setuptools
        echo "vulcan-cli ready: vulcan $$(vulcan --version)"
        exec tail -f /dev/null
```

## Step 3: Start Docker

Run these commands from the `docker/` folder:

```bash
cd docker
docker compose config --quiet
docker compose up -d
docker compose ps --all
```

Wait for Vulcan to finish installing:

```bash
docker logs --follow ldk-vulcan-cli
```

Continue when the logs show:

```
vulcan-cli ready: vulcan <version>
```

Open `http://localhost:8080` and confirm that both Spark workers are listed.

## Step 4: Initialize the Spark project

From the `docker/` folder, run:

```bash
docker exec ldk-vulcan-cli vulcan init spark -t default
```

This creates `config.yaml`, models, seed data, tests, and data-quality files in the project root.

If the project is already initialized, skip this step.

## Step 5: Configure Spark and run a plan

Open `config.yaml` in the project root. Replace its generated `gateways` block with:

```yaml
gateways:
  default:
    connection:
      type: spark
      catalog: warehouse
      config:
        "spark.master": "spark://spark-master:7077"
        "spark.app.name": "vulcan-local"
        "spark.driver.host": "vulcan-cli"
        "spark.driver.bindAddress": "0.0.0.0"
        "spark.driver.extraJavaOptions": "-Daws.region=us-east-1 -Daws.defaultRegion=us-east-1 -Djava.io.tmpdir=/tmp/iceberg"
        "spark.executor.extraJavaOptions": "-Daws.region=us-east-1 -Daws.defaultRegion=us-east-1 -Djava.io.tmpdir=/tmp/iceberg"

        "spark.driver.extraClassPath": "/root/.cache/vulcan/spark-jars/{{ env_var('VULCAN_VERSION') }}/*:dependencies/java/*"
        "spark.executor.extraClassPath": "/etc/dataos/work/dependencies/java/*"

        "spark.sql.extensions": "org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions"
        "spark.sql.defaultCatalog": "warehouse"
        "spark.sql.catalog.warehouse": "org.apache.iceberg.spark.SparkCatalog"
        "spark.sql.catalog.warehouse.type": "rest"
        "spark.sql.catalog.warehouse.uri": "http://iceberg-rest-warehouse:8181"
        "spark.sql.catalog.warehouse.warehouse": "s3://warehouse/"
        "spark.sql.catalog.warehouse.io-impl": "org.apache.iceberg.aws.s3.S3FileIO"
        "spark.sql.catalog.warehouse.s3.endpoint": "http://rustfs-warehouse:9000"
        "spark.sql.catalog.warehouse.s3.path-style-access": "true"
        "spark.sql.catalog.warehouse.s3.access-key-id": "admin"
        "spark.sql.catalog.warehouse.s3.secret-access-key": "password"
        "spark.sql.catalog.warehouse.client.region": "us-east-1"

        "spark.dynamicAllocation.enabled": "true"
        "spark.dynamicAllocation.shuffleTracking.enabled": "true"
        "spark.dynamicAllocation.initialExecutors": "1"
        "spark.dynamicAllocation.minExecutors": "1"
        "spark.dynamicAllocation.maxExecutors": "2"

    state_connection:
      type: postgres
      database: statestore
      host: "{{ env_var('STATESTORE_HOST', 'statestore') }}"
      port: "{{ env_var('STATESTORE_PORT', '5432') }}"
      user: vulcan
      password: vulcan

    state_schema: spark_local

before_all:
  - SELECT current_catalog()
```

Run the project checks:

```bash
docker exec ldk-vulcan-cli vulcan info
docker exec ldk-vulcan-cli vulcan test
```

Create and apply the plan:

```bash
docker exec ldk-vulcan-cli vulcan plan --auto-apply
```

Query the generated seed model:

```bash
docker exec ldk-vulcan-cli \
  vulcan fetchdf "SELECT * FROM warehouse.vulcan_example.seed_model LIMIT 3"
```

To stop the environment:

```bash
cd docker
docker compose down
```

To stop the environment and delete local RustFS and PostgreSQL data:

```bash
docker compose down -v
```

For errors, see [Troubleshoot Spark](https://v2.dataos.info/references/october2026/engine-guide/spark-1/troubleshooting.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://v2.dataos.info/references/october2026/engine-guide/spark-1/local-development.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
