07b5c11f43e8b8f44edb45427e2d1f72a7912c23
Daily Update Pipeline / get-mlflow-full-base-image-digest (push) Failing after 17s
Daily Update Pipeline / get-mlflow-digest (push) Successful in 8s
Daily Update Pipeline / decide-to-build (push) Successful in 1s
Daily Update Pipeline / build-and-publish (push) Has been skipped
mlflow-full
MLFlow docker container with support for Postgres. Implements extra environment variables for convenience.
Running the Container
Basic Usage
# Run with default settings
docker run -p 5000:5000 gitea.gt-proj.com/brian/mlflow-full:latest
With PostgreSQL Backend
# Using environment variables
docker run -p 5000:5000 \
-e MLFLOW_BACKEND_STORE_URI="postgresql://user:password@host:5432/mlflow" \
-e MLFLOW_DEFAULT_ARTIFACT_ROOT="s3://my-bucket/mlflow-artifacts" \
gitea.gt-proj.com/brian/mlflow-full:latest
Complete Example with Docker Compose
version: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_DB: mlflow
POSTGRES_USER: mlflow
POSTGRES_PASSWORD: mlflow_password
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
mlflow:
image: gitea.gt-proj.com/brian/mlflow-full:latest
ports:
- "5000:5000"
environment:
MLFLOW_BACKEND_STORE_URI: postgresql://mlflow:mlflow_password@postgres:5432/mlflow
MLFLOW_DEFAULT_ARTIFACT_ROOT: /mlflow/artifacts
MLFLOW_HOST: 0.0.0.0
MLFLOW_PORT: 5000
volumes:
- mlflow_artifacts:/mlflow/artifacts
depends_on:
- postgres
volumes:
postgres_data:
mlflow_artifacts:
Environment Variables
| Variable | Description | Default |
|---|---|---|
MLFLOW_BACKEND_STORE_URI |
Database connection string | sqlite:///mlflow.db |
MLFLOW_DEFAULT_ARTIFACT_ROOT |
Artifact storage location | ./mlruns |
MLFLOW_HOST |
Host to bind the server | 0.0.0.0 |
MLFLOW_PORT |
Port to bind the server | 5000 |
Advanced Examples
With S3 Artifact Storage
docker run -p 5000:5000 \
-e MLFLOW_BACKEND_STORE_URI="postgresql://user:password@host:5432/mlflow" \
-e MLFLOW_DEFAULT_ARTIFACT_ROOT="s3://my-mlflow-bucket/artifacts" \
-e AWS_ACCESS_KEY_ID="your-access-key" \
-e AWS_SECRET_ACCESS_KEY="your-secret-key" \
-e AWS_DEFAULT_REGION="us-west-2" \
gitea.gt-proj.com/brian/mlflow-full:latest
With Custom Server Arguments
docker run -p 5000:5000 \
-e MLFLOW_BACKEND_STORE_URI="postgresql://user:password@host:5432/mlflow" \
gitea.gt-proj.com/brian/mlflow-full:latest \
--host 0.0.0.0 \
--port 5000 \
--workers 4 \
--expose-prometheus /metrics
Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: mlflow-server
spec:
replicas: 1
selector:
matchLabels:
app: mlflow-server
template:
metadata:
labels:
app: mlflow-server
spec:
containers:
- name: mlflow-server
image: gitea.gt-proj.com/brian/mlflow-full:latest
ports:
- containerPort: 5000
env:
- name: MLFLOW_BACKEND_STORE_URI
value: "postgresql://mlflow:password@postgres-service:5432/mlflow"
- name: MLFLOW_DEFAULT_ARTIFACT_ROOT
value: "s3://mlflow-artifacts"
---
apiVersion: v1
kind: Service
metadata:
name: mlflow-service
spec:
selector:
app: mlflow-server
ports:
- port: 5000
targetPort: 5000
type: LoadBalancer
Features
- 🐘 PostgreSQL Support: Pre-installed
psycopg2-binaryfor PostgreSQL connectivity - 🏷️ OCI Labels: Fully compliant with OCI image specification
- 🔄 Auto-updates: Daily builds when the base MLflow image is updated
- 📦 Lightweight: Based on official MLflow container
Building Locally
# Clone the repository
git clone https://gitea.gt-proj.com/brian/mlflow-full.git
cd mlflow-full
# Build the image
docker build -t mlflow-full:local .
# Run your local build
docker run -p 5000:5000 mlflow-full:local
Languages
Dockerfile
100%