0

I have a MySQL instance running on my local machine. I want the MLflow backend store to be set up on this instance. The MLflow service resides in a Docker Compose file which has two services.

When I use network mode: host, everything works fine, but i want to be able to connect to the MySQL instance without it. The compose file configuration is as follows:

version: '3.3'

services:
  mlflow:
     restart: always
     build: mlflow

     image: mlflow_server
     #network_mode: host

     container_name: mlflow_server


     ports:
      - "5000:5000"
     environment:

       - GCP_ARTIFACT_PATH=${GCP_ARTIFACT_PATH}
       - DB_USERNAME=${DB_USERNAME}
       - DB_PASSWORD=${DB_PASSWORD}
       - GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS}


     command: mlflow server --backend-store-uri mysql+pymysql://${DB_USERNAME}:${DB_PASSWORD}@127.0.1.1:3306/mlflow --default-artifact-root ${GCP_ARTIFACT_PATH} --host 0.0.0.0

In the command section, when I used "network_mode:host", everything worked fine with "localhost" as the MySQL hostname. But with default networking mode I tried the ip 127.0.0.1 which comes from the command hostname -I when run in the local machine. I tried "host.docker.internal" in place of localhost, but it dosen't seem to work.

I am using UbuntuĀ 20.04 (Focal Fossa).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

0 Answers0