# Docker for Data Engineers

> Package pipelines and run local data stacks with Docker and Docker Compose: images, containers, volumes, networks and environment config. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/data-engineer/docker
Last updated: 2026-11-28

Package pipelines and run local data stacks with Docker and Docker Compose: images, containers, volumes, networks and environment config.

Beginner · about 6 hours · difficulty 2/5

Learn first: [Linux and the Command Line for Data Work](https://www.internhack.in/roadmaps/tracks/data-engineer/linux-cli), [Production-Grade Python](https://www.internhack.in/roadmaps/tracks/data-engineer/python-production)

Docker lets you run Postgres, Kafka, Airflow and your own pipeline code locally exactly as they run in production. Most tutorials, including the DE Zoomcamp, assume you can use it.

### Core concepts

- **Image**: a packaged filesystem plus a start command, built from a `Dockerfile`.
- **Container**: a running instance of an image.
- **Registry**: where images are stored (Docker Hub, ECR, Artifact Registry).
- **Volumes**: persist data outside the container (so your Postgres data survives restarts).
- **Networks**: containers talk to each other by service name.

### Dockerising a pipeline

- Start from a slim Python base image, copy the lock file first, install dependencies, then copy code. This order makes rebuilds fast thanks to **layer caching**.
- Pass configuration through **environment variables**; never bake secrets into images.
- One process per container; make the command parameterised (`python -m pipeline --date 2026-10-24`).

### Docker Compose

A `docker-compose.yml` defines a whole local stack (Postgres, pgAdmin, your extractor, MinIO) started with `docker compose up`. Great for portfolio projects that reviewers can run in one command.

### Beyond Docker

In production, containers run on Kubernetes, ECS, Cloud Run or as tasks launched by an orchestrator. You do not need deep Kubernetes knowledge as a junior, but know what a pod is.

### Pitfalls

- Huge images from full base images and leftover build files.
- Storing data inside a container without a volume and losing it on restart.
- `localhost` confusion: inside a container, localhost is the container itself, not your laptop.

You are ready to move on when your API extractor runs as a Docker image and a Compose file starts it alongside Postgres and MinIO with a single command.

## Key concepts

- **Images and containers**
- **Writing a Dockerfile**
- **Layer caching**
- **Volumes and networks**
- **Docker Compose**
- **Environment variables and secrets**
- **Container registries**
- **Kubernetes basics**

## Mini project

Write a Dockerfile for your API extractor and a docker-compose.yml that runs it with PostgreSQL and MinIO. Document in the README how anyone can clone the repo and run the whole stack with one command.

## Check yourself

Your containerised script cannot connect to Postgres at localhost:5432 even though Postgres is running in Compose. Why, and what is the fix?

## Free resources

- [Docker get started](https://docs.docker.com/get-started/) (Docker)
- [Docker Compose documentation](https://docs.docker.com/compose/) (Docker)
- [Docker roadmap](https://roadmap.sh/docker) (roadmap.sh)
- [Data Engineering Zoomcamp (Docker module)](https://github.com/DataTalksClub/data-engineering-zoomcamp) (DataTalksClub)

Previous: [Advanced dbt: Incremental Models, Snapshots and Macros](https://www.internhack.in/roadmaps/tracks/data-engineer/dbt-advanced) · Next: [Orchestration Concepts](https://www.internhack.in/roadmaps/tracks/data-engineer/orchestration-concepts)

## More in Containers and Orchestration

- [Docker for Data Engineers](https://www.internhack.in/roadmaps/tracks/data-engineer/docker)
- [Orchestration Concepts](https://www.internhack.in/roadmaps/tracks/data-engineer/orchestration-concepts)
- [Apache Airflow](https://www.internhack.in/roadmaps/tracks/data-engineer/airflow)
- [Dagster](https://www.internhack.in/roadmaps/tracks/data-engineer/dagster)
- [Prefect](https://www.internhack.in/roadmaps/tracks/data-engineer/prefect)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/data-engineer)
