2

To my understanding, currently (May 2019) mlflow support running project in docker environment; however, it needs the docker image already been built. This leaves the docker image building to be a separate workflow. What is the suggested way to run a mlflow project from Dockerfile?

Is there plans to support targeting Dockerfile natively in mlflow? What are the considerations about using image vs Dockerfile? Thanks!

Bin
  • 3,645
  • 10
  • 33
  • 57

2 Answers2

1

Mlflow provides the Dockerfile they use on their Github page. You can use that as a starting point. Once you are happy with how your Dockerfile looks, you can generate an image for it using docker build.

If you are satisfied with the default image, use that. If you need tweaking for your workflow, edit the Dockerfile and build an image from it.

Alassane Ndiaye
  • 4,427
  • 1
  • 10
  • 19
  • Hi Alassane, I did use the example in the repo, however, here is the actual question in this post. Due to there is an image building process operate outside mlflow process, this leaves the chance that when the Dockerfile is updated the image is not matching the Dockerfile any more. It would be ideal if in mlflow system directly target a Dockerfile instead of an image as the environment (mlflow tracks the Dockerfile change). – Bin May 13 '19 at 23:33
0

There is also a Dockerfile from an mlflow workshop which is helpful. https://github.com/afranzi/mlflow-workshop

#FROM python:3.7.0
# https://hub.docker.com/r/frolvlad/alpine-python-machinelearning/
FROM frolvlad/alpine-python-machinelearning

LABEL maintainer="Albert Franzi"

ENV MLFLOW_HOME /opt/mlflow
ENV MLFLOW_VERSION 0.7.0
ENV SERVER_PORT 5000
ENV SERVER_HOST 0.0.0.0
ENV FILE_STORE ${MLFLOW_HOME}/fileStore
ENV ARTIFACT_STORE ${MLFLOW_HOME}/artifactStore

RUN pip install mlflow==${MLFLOW_VERSION} && \
    mkdir -p ${MLFLOW_HOME}/scripts && \
    mkdir -p ${FILE_STORE} && \
    mkdir -p ${ARTIFACT_STORE}

COPY scripts/run.sh ${MLFLOW_HOME}/scripts/run.sh

EXPOSE ${SERVER_PORT}/tcp

VOLUME ["${MLFLOW_HOME}/scripts/", "${FILE_STORE}", "${ARTIFACT_STORE}"]

WORKDIR ${MLFLOW_HOME}

ENTRYPOINT ["./scripts/run.sh"]

and run.sh

#!/bin/sh
mlflow server \
    --file-store $FILE_STORE \
    --default-artifact-root $ARTIFACT_STORE \
    --host $SERVER_HOST \
    --port $SERVER_PORT
Paul Bendevis
  • 2,381
  • 2
  • 31
  • 42
  • I am asking a different question. To clarify, I am asking skipping the "build docker image from the docker file" step before calling mlflow. Please see the response to Alassane's question for details. – Bin Dec 02 '19 at 23:00