Day 6 — Model Deployment: How ML Models Go From Laptop to Docker Containers

👋 Hello! I'm passionate about DevOps and have over 1+ years of experience in the field. I'm proficient in a variety of cutting-edge technologies and always motivated to expand my knowledge and skills. Let's connect and grow together!
SKILLS:
🔹 Languages & Runtimes: Python, Shell Scripting, HCL, YAML 🔹 Cloud Technologies: AWS, Microsoft Azure, GCP 🔹 Infrastructure Tools: Docker, Terraform, AWS CloudFormation 🔹 Other Tools: Linux, Git and GitHub Actions, Jenkins, Jira, GitLab (beginner), Docker, AWS DevOps 🔹 Web Development: HTML, CSS, Bootstrap, Python, SQL
Job & Responsibilities:
🚀 Improved development efficiency by implementing CI/CD pipelines, resulting in a 30% reduction in deployment time on the test server. 🔒 Strengthened deployment and testing reliability by utilizing Docker containers and optimizing Dockerfile, reducing development issues on the test server by 20%. ⚙️ Automated S3 bucket log creation with Shell scripting, eliminating 100% of manual search and saving 2 hours per week. 📅 Scheduled EC2 instance start/stop using Lambda functions and Event Bridge, leading to a 25% decrease in infrastructure costs. 🔧 Utilized AWS, Linux, Python, Docker, Shell scripting, Terraform, Jenkins Pipelines, and automation to streamline workflows and improve overall system performance.
I'm very detail-oriented and possess strong written and verbal communication skills. As a high performer with a possibility mindset, I strive to solve problems using efficient approaches.
Let's Connect & Grow:
If you find my profile suitable for the role you are searching for, please feel free to reach out to me at sumanprasad9766@gmail.com.
So far you’ve learned:
Day 1 → What MLOps is
Day 2 → ML lifecycle
Day 3 → Data engineering basics
Day 4 → Data drift and model decay
Day 5 → Experiment tracking and model registry
Today we answer a key question:
How does a model that was trained on a laptop actually get used inside real products like food delivery apps, banking apps, or hospital systems?

This process is called Model Deployment.
Deployment means:
Making a model available so other applications can use it and make predictions.
Without deployment, a model is just a research project.
1. Why Deployment Matters So Much
Think of a doctor who knows the perfect treatment but never actually treats any patient.
That knowledge is useless. Same with ML. Companies build ML models to:
reduce fraud
improve customer experience
save costs
increase revenue
improve safety
But value only comes after deployment. This is where MLOps and DevOps meet strongly.
2. Two Main Ways Models Are Used in Production - Deployment patterns
A. Batch Inference (Predictions Done in Bulk at Intervals)
This means predictions are generated on a schedule:
hourly
daily
weekly
Not instant.
Real-World Examples
Banking: Credit scores updated once per month
E-commerce: Customer churn score calculated weekly
Insurance: Risk score calculated nightly
Hospitals: Daily patient readmission risk score
Food Delivery: Daily sales demand forecasting
How It Works
Data collected
↓
Model runs on entire dataset
↓
Results stored in database
↓
Applications use stored results later
This is useful when:
real-time is not required
performance cost is high
decisions are periodic
B. Real-Time (Online) Inference
This means the model predicts instantly when a request comes.
Real-World Examples
Banking: Fraud detection when you swipe a card
Food Delivery: ETA prediction when you place an order
E-commerce: Product recommendations while browsing
Hospitals: Emergency risk prediction during admission
How It Works
Request comes
↓
Model runs immediately
↓
Prediction returned in milliseconds
This requires:
fast systems
high availability
monitoring
scalable infrastructure
MLOps helps ensure all of this works reliably.
3. How Models Are Typically Exposed — Using APIs
Most real-time models are deployed as APIs (Application Programming Interfaces).
Think of an API like a restaurant counter. You place an order The kitchen prepares it
You receive the food Similarly, Application sends data, Model processes it, Prediction returned
APIs are built using tools like:
FastAPI
Flask
Django
gRPC
The API is then packaged and deployed using:
Docker
Kubernetes
Serverless platforms
This is where DevOps skills blend with MLOps.
4. Where Models Are Deployed — Environment Choices
Models can be deployed in:
On-Premise Servers
Used by:
banks
government
regulated industries
Because of data privacy.
Cloud Platforms
Such as:
AWS
Azure
GCP
Useful for:
scalability
flexibility
global users
Edge Devices
Such as:
mobile phones
IoT devices
hospital machines
smart cameras
Examples:
speech recognition on phone
face unlock
medical device monitoring
Deployment strategy depends on business needs.
5. Packaging Models — Why Docker Is So Important
Docker is like a tiffin box where everything required by the model is packed:
code
libraries
model file
configurations
So it runs the same everywhere: developer laptop, staging, production
This avoids
“works on my machine” problems.
DevOps already uses Docker widely,
MLOps continues the same culture.
6. Deployment Pipelines — CI/CD for ML
In DevOps, CI/CD automates:
building software
testing
deploying
In MLOps, CI/CD automates:
testing ML code
validating model accuracy
checking data quality
deploying model safely
Typical flow:
Code commit
↓
Build container
↓
Run tests
↓
Validate model
↓
Deploy to staging
↓
Deploy to production
This ensures safe, repeatable releases.
7. Deployment Strategies (Explained Simply)
Companies rarely deploy models recklessly. They use careful rollout methods, such as:
A. Blue-Green Deployment
Two environments exist:
Blue → current live version
Green → new version
Traffic switches only when tested.
If problems occur, traffic returns to Blue.
B. Canary Deployment
New model is tested on a small percentage of users first.
If results are good, it is rolled out to all users.
If not, it is rolled back.
C. Shadow Deployment
New model runs in parallel
but predictions are not shown to users.
Engineers compare results silently.
If stable → promote to production.
This is very common in banks and hospitals.
8. What Can Go Wrong During Deployment?
Many risks exist, such as:
latency too high
wrong predictions
biased decisions
accuracy drops
data pipeline failures
scaling issues
compliance violations
That is why monitoring is essential after deployment. This is not optional.
9. Monitoring Deployed Models
Once live, models must be tracked for:
uptime
response time
error rate
accuracy
drift
bias
business KPIs
Example:
Food delivery monitors:
ETA accuracy gap
customer complaints
delivery delays
Bank monitors:
fraud prevented
false alerts
Hospital monitors:
true detection rate
patient outcomes
This keeps systems safe and reliable.
10. Rollback — Safety Net for Models
Just like software releases, sometimes models must be rolled back quickly.
Reasons include:
incorrect results
bias detected
accuracy dropped
legal risk
data pipeline failure
MLOps ensures rollback is:
fast
safe
traceable
Again, similar to DevOps best practices.
11. A Simple Real-World Story
A bank deploys a new fraud detection model. At first, it performs well. Then support calls increase:
“Why are my transactions getting blocked?”
Monitoring reveals:
false positives increased.
The team:
rolls back to previous version
investigates
retrains correctly
Because tracking and deployment pipelines were in place,
this happened smoothly — without panic. That is MLOps maturity.
12. Quick Recap of Day 6
Today you learned:
what deployment means
batch vs real-time inference
APIs for ML
Docker for packaging
cloud vs on-prem vs edge
CI/CD for ML models
rollout strategies
monitoring deployed models
rollback safety
real-world use cases




