A Dockerfile that produces a miniconda3 image with MLflow installed.
To run this image locally:
docker build --rm -f "Dockerfile" -t mlflow-server:latest .
docker run --rm --name mlflow-server -v /tmp/mlruns:/mlflow/ -p 5000:5000 mlflow-server
To run this image from docker hub:
docker run -v /tmp/mlruns:/mlflow/ -p 5000:5000 seeloz/mlflow-server
To set the artifact repository with Google Cloud Storage (GCS):
First create the volume directory, e.g., /tmp/mlruns, and then copy your Google Cloud Storage bucket credentials file to it and then set the GOOGLE_APPLICATION_CREDENTIALS environment variable to that file.
mkdir -p /tmp/mlruns
cp ~/.credentials/storage.json /tmp/mlruns
docker run -v /tmp/mlruns:/mlflow/ -e "ARTIFACT_ROOT=gs://<my_gcs_bucket>/<sub_directories>" -e GOOGLE_APPLICATION_CREDENTIALS="storage.json" -p 5000:5000 seeloz/mlflow-server
You can similarly use AWS as well.
This image also supports three types of database:
In order to use MySQL, you need to create a database and then run the following:
docker run --rm -it mlflow-server mlflow db upgrade mysql://<username>:<password>@<host>/<database_name>
With Postgres, you will need to manually create the database, but no db upgrade command is required as we need with MySQL.
Here is how you can deploy to Kubernetes on Google Cloud:
Deploy a GKE Cluster with VPC-native enabled
Apply a secret containing a service account with access to GCS by following the instructions here: link
Create your Database
Postgres (Recommended!)
MySQL
PVC (Persistent-Volume-Claim)
Under Workfloads in GKE click 'Deploy'
Type in the following for the image path: "seeloz/mlflow-server"
Give it a name, such as mlflow-server
Click "Add Environment Variable"
gs://<bucket_name>/<path_to_make_artifact_root>Click "Add Environment Variable"
<db_type>:<username>:<password>@<internal_ip_of_database>/<database>
postgresql://postgres:[email protected]/store/mlflow/storeClick "Add Environment Variable"
/var/secrets/google/key.jsonIn Workfloads select your deployment and click Edit
Add the following to your spec/template/spec/containers section:
volumeMounts:
- mountPath: /var/secrets/google
name: google-cloud-key
volumes:
- name: google-cloud-key
secret:
secretName: gcs-key
/mlflow/storeRedeploy your pod deployment; this may happen automatically, but you can also force it by setting the Scale to 0, waiting for the pod count to go to zero, and then setting it back.
In your deployment, click on Expose and create a Load Balancer service with an external IP.
And that's it! Once the service is created, click on the web link and you should be good to go. That same load-balancer ip address is also what you should pass to things like your MLflowcontext class.
Content type
Image
Digest
Size
357.4 MB
Last updated
about 7 years ago
docker pull seeloz/mlflow-server