Containerize your machine learning model with Docker and running it on Kubernetes- Part 1
What we will learn
Overview
What is docker?
Why should a data scientist be concerned with this?
Installing docker
Confirm the docker installation is fine
Simple illustration of packaging application with docker
Docker image internal workings steps
Docker image internal workings illustration-1
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:
It is working on my dev system.
It worked very well in the QA environment.
I am not sure what is wrong with the production environment.
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:
Go to your command line or terminal
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
Build a simple salary prediction model.
Turn the model into an API using flask.
Package it into a container image using docker.
Host it and run it to confirm and validate our understanding.
Docker commands