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