Fix MLflow psycopg2 missing by installing psycopg2-binary at startup

The official MLflow image lacks psycopg2. Install it via pip before
starting the server. Also fix artifact root to use absolute path
inside the mounted volume.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-21 09:54:51 +01:00
parent d7f583701c
commit c77d17e5e2

View file

@ -68,12 +68,15 @@ services:
- "127.0.0.1:5000:5000" - "127.0.0.1:5000:5000"
volumes: volumes:
- mlflow-data:/mlflow - mlflow-data:/mlflow
command: > entrypoint: ["/bin/sh", "-c"]
mlflow server command:
--backend-store-uri "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}" - |
--default-artifact-root ./mlruns/artifacts pip install --quiet psycopg2-binary &&
--host 0.0.0.0 mlflow server
--port 5000 --backend-store-uri "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}"
--default-artifact-root /mlflow/artifacts
--host 0.0.0.0
--port 5000
restart: unless-stopped restart: unless-stopped
postgres: postgres: