Containerize your machine learning model
with Docker and running it on Kubernetes-
Part 1

Containerize your machine learning model with Docker and running it on Kubernetes- Part 1

What we will learn

  1. Overview

  2. What is docker?

  3. Why should a data scientist be concerned with this?

  4. Installing docker

  5. Confirm the docker installation is fine

  6. Simple illustration of packaging application with docker

  7. Docker image internal workings steps

  8. Docker image internal workings illustration-1

  9. Docker image internal workings illustration-2

The concept here is to start small and grow the understanding so everyone can benefit.

Introduction

I am sure organizations (depending on how the engineering team is structured) are used to these kinds of statements from software developers/engineers, Application managers, and QA:

  1. It is working on my dev system.

  2. It worked very well in the QA environment.

  3. I am not sure what is wrong with the production environment.

  4. It seems we missed out on some dependencies during migration to production.

This is the reason why docker and Kubernetes were created to help with the processing of packaging, deploying and management of applications to eliminate identified concerns above.

Why should a Data Scientist be concerned with this?

It depends on the specific needs and requirements of the AI model. In general, deploying AI models on docker and Kubernetes can provide increased scalability, flexibility and reliability for large-scale AI models which is useful for AI models that need to handle large amounts of data and computational resources.

What is Docker?

While building an application that has libraries or dependencies, frontend, backend, and database. You will agree with me that if any of these components are missing during the deployment stage that the application is not going to work.

Imagine packaging all of these dependencies (frontend, backend, database, and libraries) into a single container and then having that container deployed on production. This is why docker was created.

Docker is a tool that empowers developers to package their applications and their dependencies into an image.

Installing docker

Docker can be installed on Windows, Mac, or Linux.

Follow this URL to have docker installed based on your OS: https://docs.docker.com/get-docker/

Step-by-step installation guide for Windows

https://www.simplilearn.com/tutorials/docker-tutorial/install-docker-on-windows

Step-by-step installation guide for ubuntu

https://www.simplilearn.com/tutorials/docker-tutorial/how-to-install-docker-on-ubuntu

Step-by-step installation guide for Mac

https://www.youtube.com/watch?v=MU8HUVlJTEY

Confirm if docker is properly installed

To confirm if docker was properly installed:

  1. Go to your command line or terminal

  2. Type in docker

You should see a screen similar to the screenshot below (in my case am using windows OS)

What we will learn next in part 2 of this post

  1. Build a simple salary prediction model.

  2. Turn the model into an API using flask.

  3. Package it into a container image using docker.

  4. Host it and run it to confirm and validate our understanding.

  5. Docker commands