Environment:Apache Airflow Docker Container Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Container, Deployment |
| Last Updated | 2026-02-08 20:00 GMT |
Overview
Debian Bookworm Slim-based Docker container with Python 3.12.12, pip 26.0.1, uv 0.10.0, and multi-stage build support for production Airflow images.
Description
This environment defines the Docker container build and runtime requirements for Apache Airflow. The official Dockerfile uses a multi-stage build pattern starting from `debian:bookworm-slim`. It installs system-level dependencies (PostgreSQL client, MySQL/MariaDB client, Kerberos, LDAP, ODBC, SASL), then installs Python with the specified version, and finally installs Airflow with its chosen extras. The container uses `dumb-init` as the init process and supports both pip and uv as package managers. MariaDB 10.11 LTS client is used instead of Oracle MySQL client due to GPG key expiration issues.
Usage
Use this environment when building custom Airflow Docker images or when deploying Airflow via Docker Compose or Kubernetes. The Dockerfile supports customization via build arguments for Python version, Airflow version, extras, and additional pip packages.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Base Image | `debian:bookworm-slim` | Debian 12 minimal image |
| Docker | Docker CE with buildx | Required for multi-stage builds |
| Docker Compose | v2+ | For local multi-container deployments |
| Disk | 1-5GB | Depending on extras installed |
Dependencies
Build Arguments
- `AIRFLOW_VERSION` = 3.1.7
- `AIRFLOW_PYTHON_VERSION` = 3.12.12
- `AIRFLOW_PIP_VERSION` = 26.0.1
- `AIRFLOW_UV_VERSION` = 0.10.0
- `AIRFLOW_PREK_VERSION` = 0.3.2
- `BASE_IMAGE` = debian:bookworm-slim
- `PYTHON_LTO` = true (set to false for FIPS compliance)
Runtime System Packages
- `curl`, `wget`, `git`
- `freetds-bin` (MSSQL client)
- `krb5-user`, `ldap-utils`
- `libev4`, `libgeos-dev`
- `libsasl2-2`, `libsasl2-modules`
- `libxmlsec1`
- `postgresql-client`
- `sqlite3`
- `unixodbc`
- `dumb-init`
Database Client Packages
- MariaDB 10.11 LTS client (preferred over Oracle MySQL)
- `msodbcsql18` (MSSQL ODBC driver)
- `postgresql-client`
Credentials
No credentials required at build time. Runtime credentials are injected via environment variables:
- `AIRFLOW__DATABASE__SQL_ALCHEMY_CONN`: Database connection
- Container registry credentials if pulling from private registry
Quick Install
# Build production Airflow image
docker build . -t my-airflow:latest \
--build-arg AIRFLOW_VERSION=3.1.7 \
--build-arg AIRFLOW_EXTRAS="celery,postgres,redis"
# Build with custom Python version
docker build . -t my-airflow:latest \
--build-arg AIRFLOW_PYTHON_VERSION=3.11.9
# Run standalone for testing
docker run -p 8080:8080 my-airflow:latest standalone
Code Evidence
Base image and version defaults from `Dockerfile:48-52`:
ARG AIRFLOW_VERSION="3.1.7"
ARG BASE_IMAGE="debian:bookworm-slim"
ARG AIRFLOW_PYTHON_VERSION="3.12.12"
Package manager versions from `Dockerfile:72-74`:
ARG AIRFLOW_PIP_VERSION=26.0.1
ARG AIRFLOW_UV_VERSION=0.10.0
MariaDB preference over Oracle MySQL from `Dockerfile:408`:
# MariaDB 10.11 LTS packages are used instead of Oracle MySQL
# due to GPG key expiration issues with Oracle repository
Default extras from `Dockerfile:39`:
ARG AIRFLOW_EXTRAS="aiobotocore,amazon,async,celery,cncf-kubernetes,common-io,common-messaging,docker,elasticsearch,fab,ftp,git,google,google-auth,graphviz,grpc,hashicorp,http,ldap,microsoft-azure,mysql,odbc,openlineage,pandas,postgres,redis,sendgrid,sftp,slack,snowflake,ssh,statsd,uv"
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `GPG key expired` during MySQL client install | Oracle MySQL GPG key issue | Use MariaDB 10.11 LTS client instead (default behavior) |
| `dumb-init: not found` | Missing init process | Ensure `dumb-init` is installed in the final stage |
| Build fails with LTO errors | FIPS environment incompatibility | Set `PYTHON_LTO="false"` build argument |
| `pip: command not found` | Wrong Python path | Ensure `AIRFLOW_PYTHON_VERSION` matches installed Python |
Compatibility Notes
- FIPS Compliance: Set `PYTHON_LTO="false"` to disable Link-Time Optimization for FIPS-compliant builds.
- MariaDB vs MySQL Client: MariaDB 10.11 LTS is the default client. Oracle MySQL client is deprecated due to GPG key maintenance issues.
- MSSQL Support: Requires `msodbcsql18` driver from Microsoft repository.
- Multi-stage Build: The Dockerfile uses multiple stages to minimize final image size. Build-time dependencies (compilers, dev headers) are not present in the runtime image.