Implementation:Mlflow Mlflow Docker Compose Deployment
| Knowledge Sources | |
|---|---|
| Domains | Deployment, Infrastructure |
| Last Updated | 2026-02-13 20:00 GMT |
Overview
A Docker Compose configuration that provides a one-command deployment of the MLflow tracking server with PostgreSQL as the backend store and MinIO as the S3-compatible artifact store.
Description
docker-compose.yml defines a multi-container deployment stack consisting of four services:
- postgres: A PostgreSQL 15 database that serves as the MLflow backend store for experiment and run metadata. It uses a named volume (pgdata) for persistent storage and includes a health check using pg_isready.
- minio: A MinIO object storage server that provides S3-compatible artifact storage. It exposes both the API port (9000) and the console port (9001), uses a named volume (minio-data) for persistence, and includes a health check via the MinIO health endpoint.
- create-bucket: An initialization service using the MinIO client (mc) that creates the artifact bucket after MinIO becomes healthy. This service runs once and does not restart.
- mlflow: The MLflow tracking server running from the official ghcr.io/mlflow/mlflow image. It depends on all other services being healthy or completed, installs psycopg2-binary and boto3 at startup, and launches mlflow server with the configured backend store URI and artifact destination with --serve-artifacts enabled.
All services communicate over a custom Docker network named mlflow-network. Configuration is externalized through environment variables, with defaults provided in the companion .env.dev.example file.
Usage
Use this configuration for local development, testing, or lightweight production deployments of MLflow with durable storage backends. Copy .env.dev.example to .env and customize the values before running.
Code Reference
Source Location
- Repository: Mlflow_Mlflow
- File: docker-compose/docker-compose.yml
- Lines: 1-109
Configuration
volumes:
pgdata:
minio-data:
services:
postgres:
image: postgres:15
container_name: mlflow-postgres
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
minio:
image: minio/minio:latest
container_name: mlflow-minio
command: server /data --console-address ":9001"
ports:
- "9000:9000"
- "9001:9001"
create-bucket:
image: minio/mc:latest
container_name: mlflow-create-bucket
depends_on:
minio:
condition: service_healthy
mlflow:
image: ghcr.io/mlflow/mlflow:${MLFLOW_VERSION}
container_name: mlflow-server
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
create-bucket:
condition: service_completed_successfully
ports:
- "${MLFLOW_PORT}:${MLFLOW_PORT}"
networks:
default:
name: mlflow-network
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| POSTGRES_USER | env var | Yes | PostgreSQL username |
| POSTGRES_PASSWORD | env var | Yes | PostgreSQL password |
| POSTGRES_DB | env var | Yes | PostgreSQL database name |
| MINIO_ROOT_USER | env var | Yes | MinIO root user |
| MINIO_ROOT_PASSWORD | env var | Yes | MinIO root password |
| MINIO_HOST | env var | Yes | MinIO hostname (typically "minio" within the Docker network) |
| MINIO_PORT | env var | Yes | MinIO API port (default: 9000) |
| MINIO_BUCKET | env var | No | MinIO bucket name (default: "mlflow") |
| MLFLOW_BACKEND_STORE_URI | env var | Yes | PostgreSQL connection string for MLflow |
| MLFLOW_ARTIFACTS_DESTINATION | env var | Yes | S3 URI for artifact storage (e.g., "s3://mlflow/") |
| MLFLOW_S3_ENDPOINT_URL | env var | Yes | MinIO endpoint URL for S3 compatibility |
| AWS_DEFAULT_REGION | env var | Yes | AWS region for Boto3 (e.g., "us-east-1") |
| MLFLOW_HOST | env var | Yes | MLflow server bind address (e.g., "0.0.0.0") |
| MLFLOW_PORT | env var | Yes | MLflow server port (e.g., 5000) |
| MLFLOW_VERSION | env var | Yes | MLflow Docker image tag (e.g., "v3.3.0" or "latest") |
Outputs
| Name | Type | Description |
|---|---|---|
| MLflow UI | HTTP | MLflow tracking server accessible at http://localhost:${MLFLOW_PORT} |
| MinIO Console | HTTP | MinIO web console accessible at http://localhost:9001 |
| PostgreSQL | TCP | PostgreSQL database accessible at localhost:5432 |
Usage Examples
Basic Startup
# Copy and customize environment variables
cd docker-compose
cp .env.dev.example .env
# Start all services
docker compose up -d
# Verify MLflow is running
curl http://localhost:5000/health
Tear Down
# Stop and remove containers (volumes persist)
docker compose down
# Stop and remove containers AND volumes
docker compose down -v
Service Dependency Graph
The services start in the following order based on health check dependencies:
- postgres and minio start in parallel
- create-bucket starts after minio is healthy
- mlflow starts after postgres is healthy, minio is healthy, and create-bucket has completed successfully