0

I want to train Azure Machine Learning model on azure using Azure Machine Learning Service. But I want to use the custom Docker image for deploying the model on azure. I am not able to understand how to deploy Machine Learning models using Custom Docker Image.

Please share me if there is any tutorial or blog about the deploy ml models using a custom image.

Please check the below Docker file commands:-

# Set locale
RUN apt-get update
RUN apt-get install locales
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

# Install MS SQL v13 driver for PyOdbc
RUN apt-get install -y curl
RUN apt-get install apt-transport-https
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update

RUN ACCEPT_EULA=Y apt-get install -y msodbcsql
RUN apt-get install -y unixodbc-dev

I want to use the Azure Container Registry for push the docker image and use the Custom Docker Image. Please let me know if there is any way.

Is there any way to Deploy Azure ML Models using Custom docker images?

Akshay Godase
  • 239
  • 7
  • 15

1 Answers1

1

You can do following:

  1. Create an [Environment][1] with the coordinates of your custom Docker image specified in Docker section.
  2. Create [InferenceConfig][2] with that Environment as argument, and use it when deploying the model.

For example, assuming you have a model already and eliding other arguments:

from azureml.core.environment import Environment
from azureml.core.model import InferenceConfig

env = Environment(name="myenv")
env.docker.base_image = "mybaseimage"
env.docker.base_image_registry.address = "ip-address"
env.docker.base_image_registry.username = "my-username"
env.docker.base_image_registry.password = "my-password"

ic = InferenceConfig(…,environment = env)
model.deploy(…,inference_config = ic)

  [1]: https://learn.microsoft.com/en-us/python/api/azureml-core/azureml.core.environment.environment?view=azure-ml-py
  [2]: https://learn.microsoft.com/en-us/python/api/azureml-core/azureml.core.model.inferenceconfig?view=azure-ml-py
  • @Roope_Astala Can you please share me more details on above? If you have any steps, then please share me. I have created the docker image it's on the docker hub. I want to use this image. – Akshay Godase Sep 24 '19 at 08:00
  • I added more details to answer. If you're using docker hub, you won't need the username and password information in docker.base_image_registry section. – Roope Astala - MSFT Sep 25 '19 at 11:55
  • @Roope_Astala I am trying to use a docker hub image. But I got below error `Specified base docker image godaseakshay/azuremlpyodbc not found`. – Akshay Godase Sep 26 '19 at 10:20
  • @Roope_Astala Above comment issue solved from me. I have added Tag in `godaseakshay/azuremlpyodbc:azure_ml_pyodbc_new`. It's work now properly – Akshay Godase Oct 01 '19 at 07:25
  • @Roop_Astala I have successfully registered the models using a custom docker image. but I am trying to deploy the model on azure but I got timeout error. Can you please help me. I am not able to understood why it takes lots of time. – Akshay Godase Oct 02 '19 at 06:40