Skip to content
Star
478
Star
478

Airflow

This guide shows you how to work with Apache Airflow locally using Docker. This lab demonstrates a simple ETL pipeline with extract, transform, and load tasks running as a scheduled DAG.

  • Docker installed and running.
  1. Install dependencies:

    Terminal window
    pip install uv && uv sync
  2. Create required directories:

    Terminal window
    mkdir -p dags logs plugins
  3. Start Infrastructure: Launch all Airflow services:

    Terminal window
    docker compose up -d
  4. Enable DAG:

    • Open the Airflow UI in your browser (credentials from .env):
      Terminal window
      http://localhost:8080
    • Enable the etl_pipeline DAG by clicking the toggle switch. The DAG runs automatically every 30 seconds.
  • Airflow UI:
    • Monitor: Click the DAG name to view the Graph (extract_tasktransform_taskload_task).
    • Logs: Click a task box, select the task instance, then click Log to inspect ETL output.
  • Inspect generated files: the files created inside the worker container:
    Terminal window
    docker exec -it <worker_container_id> ls -la storage/extract/
    docker exec -it <worker_container_id> ls -la storage/transform/
    docker exec -it <worker_container_id> ls -la storage/load/
Terminal window
docker compose down -v
rm -rf logs/*
IssueSolution
Services not startingCheck logs with docker compose logs. Initialization may take 30-60 seconds.
DAG not appearingEnsure files are in dags/, check for Python errors, and refresh the UI.