·8 min read

Docker Ecosystem Overview - Understanding the Core Components

Docker Engine, Docker Hub, and Docker Compose: what each piece actually does, where it breaks, and which one you're really fighting when something fails.

When someone says "Docker," what are they actually talking about? The command-line tool? The daemon running on your machine? The website where you download images?

All of the above. Most people only touch the CLI, but there are a few separate moving parts behind it, and knowing which one you're talking to is half of debugging Docker.

TL;DR: Docker has three core pieces: Docker Engine (the thing that actually runs containers on your machine), Docker Hub (basically GitHub for container images), and Docker Compose (the YAML file that lets you define multi-container setups). You need Engine to run anything, Hub to share/download images, and Compose when you graduate from single containers to actual applications.


Why This Matters

I've seen teams struggle with Docker because they don't understand which piece does what. Someone runs docker run and gets "permission denied." Is that the Engine? A Hub auth issue? Look at the full error:

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

That's the CLI failing to reach the daemon. Nothing to do with Hub, nothing to do with your image. If the error says pull access denied or toomanyrequests, that's the registry. Once you know the pieces, the error message usually tells you which one broke.

Docker Engine - The Foundation

The Engine is a client-server setup. The docker CLI is just a client. It sends REST calls over a Unix socket to dockerd, and dockerd does the real work. Under it, there are more layers than most people expect:

docker CLI --(REST, /var/run/docker.sock)--> dockerd --(gRPC)--> containerd --> containerd-shim-runc-v2 --> runc --> your process

A few practical consequences of that split:

  • docker version prints a Client and a Server section. If the Server part errors out, the daemon is down or unreachable, and no amount of image debugging will help.
  • The CLI doesn't have to be on the same machine. DOCKER_HOST=ssh://user@buildbox docker ps talks to a remote daemon, and docker context lets you save those targets.
  • containerd is the same runtime Kubernetes uses on most clusters these days. Kubernetes dropped dockershim in 1.24, so your nodes don't run dockerd at all, but the images you build with Docker run there unchanged.

The permission denied fix (and why it's not free)

The usual fix for the error above:

sudo usermod -aG docker $USER
# log out and back in (or: newgrp docker)

Know what you're doing here. Anyone in the docker group can run docker run -v /:/host --privileged ... and own the host. The group is root-equivalent. On a personal laptop, fine. On a shared build server, think twice, or look at rootless mode.

What the Engine uses from the kernel

Containers aren't a kernel object. The Engine stitches them together from Linux features:

  • Namespaces give each container its own view of PIDs, network, mounts, hostname
  • cgroups enforce the --memory and --cpus limits
  • overlay2 (the default storage driver) stacks read-only image layers with one writable layer on top

That's why containers start in milliseconds and VMs don't: there's no second kernel to boot. It's also why a container with no --memory limit can eat the whole host.

Docker Hub - The Container Registry

Docker Hub is essentially GitHub for container images: you pull public images, push your own, and keep private repos for internal stuff. Official images (postgres, nginx, redis) are maintained and scanned, and they're where I start for anything off the shelf.

What docker pull nginx actually means

The short name hides a lot of defaults. These two are the same:

docker pull nginx
docker pull docker.io/library/nginx:latest

Registry docker.io, namespace library (official images), tag latest. Any time you see a bare image name, Docker Hub is being assumed. For anything that isn't Hub you have to spell out the registry: ghcr.io/org/app:1.4.2, <account>.dkr.ecr.<region>.amazonaws.com/app:1.4.2.

Images are pulled layer by layer, and layers you already have are skipped. That's why the second pull of a similar image is fast, and why ordering your Dockerfile so dependencies come before code saves real build time.

The things that bite

  • Rate limits. Anonymous pulls from Hub are rate-limited per IP. CI runners behind one NAT hit this fast and fail with toomanyrequests: You have reached your pull rate limit. Fix: docker login in CI, or put a pull-through cache/mirror in front (registry-mirrors in /etc/docker/daemon.json, which only applies to Hub pulls).
  • latest is just a tag. It's not "newest", it's whatever was pushed last with that name. Pin a version, or a digest (nginx@sha256:...) if you need it truly immutable.
  • Images disappear or move. Upstream projects do change where and how they publish. If production depends on a public image, mirror it into your own registry.

Beyond Docker Hub

Hub is the default, not the only option:

  • AWS ECR for Amazon cloud deployments
  • Google Artifact Registry for Google Cloud (GCR, the old Container Registry, is shut down)
  • Azure ACR for Microsoft Azure
  • GHCR if your code and CI already live on GitHub
  • Harbor for self-hosted registries, and the usual answer for air-gapped environments

My rule: if your workloads run in a cloud, use that cloud's registry. Same network, IAM-based auth, no Hub rate limits.

Docker Compose - Managing Multi-Container Applications

Real applications rarely run in a single container. You need a web server, a database, a cache, maybe some workers. Compose puts all of that in one YAML file and one command.

First, a version note: use docker compose (with a space, the v2 plugin). The old Python docker-compose binary is end-of-life since 2023. Most tutorials, including the older version of this post, still show the hyphen.

A Real Example

services:
  web:
    build: .
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://user:pass@db:5432/myapp
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started
 
  db:
    image: postgres:16
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: myapp
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user -d myapp"]
      interval: 5s
      timeout: 3s
      retries: 10
 
  redis:
    image: redis:7-alpine
 
volumes:
  postgres_data:

What's going on in there that isn't obvious:

  • No version: key. Compose v2 ignores it and prints the attribute 'version' is obsolete. Delete it.
  • db in the URL is the service name. Compose puts all services on one network with DNS, so web reaches Postgres at db:5432. No IPs, no links.
  • depends_on alone only waits for the container to start, not for Postgres to accept connections. Your app boots, tries to connect, and crashes. condition: service_healthy plus a healthcheck is what actually waits.
  • The credentials have to match. POSTGRES_USER/POSTGRES_PASSWORD on the db side and the DATABASE_URL on the web side are two places to keep in sync. Put them in a .env file next to the compose file, and keep that file out of git.

The commands you'll actually use

docker compose up -d            # start everything in the background
docker compose logs -f web      # follow one service's logs
docker compose exec web sh      # shell into a running service (bash often isn't in slim images)
docker compose up -d --build    # rebuild your images and restart what changed
docker compose down             # stop and remove containers and the network
docker compose down -v          # same, AND delete named volumes (your database is gone)

That last one deserves a warning. down -v is the "start fresh" button people paste from Stack Overflow. On a dev box, fine. Anywhere with data you care about, don't.

How It Fits Together

A typical cycle:

  1. Write code and a Dockerfile
  2. docker build -t myorg/myapp:1.4.2 . builds an image locally (the Engine)
  3. docker push myorg/myapp:1.4.2 uploads it (Hub, or your registry)
  4. Teammates run docker compose up and get the full stack locally
  5. Environment differences go in compose.override.yaml or per-env .env files, not in a copy of the whole compose file

Push a real version tag, not just latest. When something breaks in staging, "which image is running?" should have a one-word answer.

About scaling: docker compose up --scale web=3 exists, but with a fixed host port like "3000:3000" the second replica fails because the port is already taken. Compose is one machine. Once you need multiple hosts, failover, or rolling deploys, that's Kubernetes (or a managed container service), not more Compose.

Practices That Actually Matter

  • Pin image tags. Don't rely on latest in production.
  • Multi-stage builds. Compile in a fat image, copy the binary into a slim one.
  • Health checks. Without them, Docker and Compose only know "process is running", not "app is ready".
  • Resource limits. --memory/--cpus on docker run, deploy.resources.limits in Compose. Without them one leaky container takes the host down.
  • Don't run as root. Add a USER line to the Dockerfile.
  • Volumes for anything that must persist. The container's writable layer is gone the moment the container is removed.
  • Keep images lean. Every extra package is more pull time and more CVEs in your scanner report.

Final thoughts

The ecosystem looks intimidating from the outside, but the moving parts are pretty clean once you've named them: the Engine actually runs containers, Hub stores images, Compose orchestrates a handful of them on one machine. That's most of the tool.

You don't have to learn it all at once. Get comfortable running a single container with the Engine, then grab images from Hub when you need a stack, then reach for Compose the first time you find yourself running three docker run commands in a specific order.

Even with Kubernetes everywhere now, this foundation hasn't aged out. Kubernetes runs the same images on the same containerd, and when a pod won't start, the debugging still comes down to these primitives.


A note on how this was written: I used AI to help with phrasing and structure. The tone, the opinions, the war stories, the code, and everything else here are mine.