What is Docker
Python courses
What is Docker
Docker is a tool that lets you package an application together with everything it needs to run and then run it consistently anywhere.
The simplest mental model is:
Docker = a standardized box for your application.
The problem Docker solves
Imagine you build a Python application on your laptop:
Python 3.12
pandas 2.x
requests
PostgreSQL client
some configurationIt works perfectly.
Then you give it to someone else, and they get:
"It doesn't work on my machine."Maybe they have Python 3.10, a different library version, or a missing dependency.
Docker helps solve this by packaging the environment:
┌─────────────────────────────┐
│ Docker Container │
│ │
│ Your application │
│ Python │
│ Libraries │
│ Configuration │
│ │
└─────────────────────────────┘You can then run that container on another machine with much less environment mismatch.
Docker vs a Virtual Machine
They're related, but not the same.
A traditional virtual machine might look like:
Computer
│
├── Operating System
│
├── Virtual Machine
│ ├── Guest OS
│ ├── Application
│ └── Dependencies
│
└── Virtual Machine
├── Guest OS
└── ApplicationDocker containers typically look more like:
Computer
│
├── Operating System
│
├── Docker
│
├── Container
│ ├── Application
│ └── Dependencies
│
└── Container
├── Application
└── DependenciesContainers share the host OS kernel, so they're generally lighter and faster to start than full VMs.
The 3 Docker concepts you should know
1. Image
An image is a packaged template for a container.
For example:
Python image
+
Your code
+
requirements.txt
↓
Your Docker imageYou can think of an image as a blueprint.
2. Container
A container is a running instance of an image.
Image
↓
Container
↓
Running applicationYou can create multiple containers from the same image.
3. Dockerfile
A Dockerfile tells Docker how to build your image.
For example:
FROM python:3.12
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]This basically says:
Start with Python 3.12
Create
/appInstall the dependencies
Copy the application
Run
app.py
How Docker fits with Airflow and Spark
This is where things get interesting for data engineering.
You could have:
Docker
│
┌───────────┼───────────┐
↓ ↓ ↓
Airflow Spark PostgreSQL
│ │
└───────────┼───────────┘
↓
DataFor example, you might run Airflow inside Docker containers:
Docker
│
├── Airflow scheduler
├── Airflow webserver
├── PostgreSQL
└── Your data pipelineAnd Airflow could then trigger a Spark job:
Airflow
│
│ triggers
↓
Spark
│
│ processes
↓
Large datasetSo these technologies have different jobs:
| Technology | Main job |
|---|---|
| Docker | Package and run applications consistently |
| Airflow | Schedule and orchestrate workflows |
| Spark | Process large datasets |
| PostgreSQL | Store/query relational data |
The easiest analogy
Imagine a restaurant:
Docker = the kitchen setup packaged so it can be reproduced elsewhere
Airflow = the manager deciding what gets done and when
Spark = the team doing large-scale food preparation
PostgreSQL = the storage/database keeping the ingredients and records
If you're learning these for data engineering, I'd learn them in roughly this order:
Python → SQL → Linux → Git → Docker → Spark → Airflow → Cloud (AWS/Azure/GCP).


Docker is a platform used to build, package, and run applications inside containers. A Docker container contains the application along with its required libraries, dependencies, and configuration, allowing it to run consistently across different systems. Airflow Course.Docker is commonly used by developers and data engineers to deploy Python applications, APIs, databases, machine learning models, and data pipelines. For example, a Python application can be packaged into a Docker image and then run as a container on a developer's laptop, server, or cloud platform without manually installing all its dependencies.
ReplyDelete