DEV Community

Sailee Shingare
Sailee Shingare

Posted on • Originally published at Medium

What is Docker? Containerization Made Simple

By Sailee Shingare | M.S. in Computer Science, Northern Illinois University (NIU)

In the last post, we learned what containers are — lightweight, portable packages that run applications consistently across any environment.

But how do you actually create and run a container?

That’s where Docker comes in.

What is Docker?

Docker is an open-source platform that makes it easy to build, ship, and run containers.

Before Docker, containers existed but were complicated to work with. Docker made them accessible to everyday developers with simple commands and tools. When Docker launched in 2013, it changed the software industry overnight.

Today Docker is the industry standard for containerization. If you work in cloud, DevOps, or software engineering — you will use Docker.

Key Docker Concepts

Before running your first container, understand these four terms:

Dockerfile A plain text file with instructions to build a container image. Think of it as a recipe — it tells Docker exactly how to package your application.

Image The built package created from a Dockerfile. It’s a read-only template containing your application and everything it needs to run. Think of it as a blueprint.

Container A running instance of an image. One image can run as many containers as you need. Think of it as a house built from a blueprint.

Docker Hub A public registry where Docker images are stored and shared. Like GitHub but for container images. You can pull thousands of pre-built images from here for free.

How Docker Works

Here’s the simple flow:

Dockerfile → docker build → Image → docker run → Container

1. You write a Dockerfile describing your application
2. Docker builds it into an image
3. You run the image to create a container
4. Your application runs inside that container

Your First Dockerfile

Let’s say you have a simple Python web app. Here’s what a Dockerfile looks like:

# Start from an official Python base image
FROM python:3.11-slim

# Set the working directory inside the container
WORKDIR /app

# Copy your requirements file
COPY requirements.txt .

# Install dependencies
RUN pip install -r requirements.txt

# Copy your application code
COPY . .

# Tell Docker which port your app uses
EXPOSE 5000

# Command to run your application
CMD ["python", "app.py"]

Each line is an instruction. Docker reads them top to bottom and builds your image layer by layer.

Essential Docker Commands

These are the commands you’ll use every day:

# Pull an image from Docker Hub
docker pull nginx

# Build an image from a Dockerfile
docker build -t myapp:1.0 .

# Run a container from an image
docker run -d -p 8080:80 myapp:1.0

# List running containers
docker ps

# Stop a container
docker stop <container_id>

# List all images
docker images

# Remove an image
docker rmi myapp:1.0

# View container logs
docker logs <container_id>

A Real World Example

Here’s how Docker solves a common problem.

You build a Python app on your laptop using Python 3.11. Your teammate has Python 3.8. Your production server has Python 3.9. The app behaves differently on each machine.

With Docker:

1. You define Python 3.11 in your Dockerfile
2. Build the image once
3. Everyone runs the same image — same Python version, same libraries, same behavior

Your laptop, your teammate’s laptop, and the production server all run the exact same container. The “it works on my machine” problem disappears completely.

Docker Hub — Your Image Library

Docker Hub at hub.docker.com has over 100,000 pre-built images you can use for free.

Need a database? Instead of installing PostgreSQL locally:

docker run -d -e POSTGRES_PASSWORD=mypassword postgres:15

One command. PostgreSQL is running in seconds. No installation, no configuration headaches.

Need a web server?

docker run -d -p 80:80 nginx

Nginx is live on port 80 instantly.

This is why developers love Docker — it eliminates hours of setup and configuration.

Install Docker and Try it Yourself

1. Download Docker Desktop at docker.com/products/docker-desktop — free for personal use
2. Install and open it
3. Open your terminal and run:
docker run hello-world

You’ll see a success message confirming Docker is working. Then try:

docker run -d -p 80:80 nginx

Open your browser and go to localhost — you’ll see the Nginx welcome page. You just ran a web server in a container with one command.

What’s Next?

Now you know how to build and run individual containers with Docker. But real applications have multiple containers — a frontend, a backend, a database.

How do you manage them all together? How do you scale when traffic spikes? How do you ensure containers restart if they crash?

The answer is Kubernetes — and that’s exactly what we’ll cover in the next post.

Top comments (0)