Skip to content
ohsudo, Home

Learning path

Docker: from first container to production

The daemon, images, Compose, and containers that stop when they shouldn't.

4 stages · 13 steps

  1. Stage 1

    The basics

    The commands, and the first errors almost everyone meets.

    1. 1

      Cheat sheet

      Docker CLI Cheat Sheet

      The Docker commands you use every day — containers, images, volumes, networks, Compose, troubleshooting and cleanup — on one printable page.

    2. 2

      Article

      "Cannot connect to the Docker daemon. Is the docker daemon running?": every cause

      Fix "Cannot connect to the Docker daemon. Is the docker daemon running?": start the service, read why it failed, check DOCKER_HOST, contexts, Docker Desktop and WSL.

    3. 3

      Article

      Docker: "permission denied while trying to connect to the Docker daemon socket"

      Fix Docker "permission denied" on /var/run/docker.sock: add your user to the docker group, make it take effect, and know why chmod 666 is a bad idea.

    4. 4

      Article

      Docker "pull access denied": the repository doesn't exist, or you're not logged in

      Fix Docker "pull access denied, repository does not exist or may require docker login": check the image name and tag, log in to the right registry, handle rate limits.

  2. Stage 2

    Build images

    Write a Dockerfile, and fix the build and start errors that come from it.

    1. 5

      Tool

      Dockerfile Generator

      Multi-stage Dockerfiles for Node, Python, Go and Java, running as a non-root user.

    2. 6

      Article

      Docker build "failed to compute cache key: … not found": why COPY can't see your file

      Fix "failed to compute cache key … not found" and "COPY failed": the file is outside the build context, excluded by .dockerignore, or missing in CI.

    3. 7

      Article

      Docker "exec format error": the wrong CPU architecture, or a script with no shebang

      Fix Docker "exec /app: exec format error": an image built for another architecture (arm64 vs amd64) or a script with no shebang. Check it, then build with buildx.

    4. 8

      Article

      Alpine "not found" for a binary that's right there: glibc vs musl

      A binary exists on Alpine, yet running it says "not found" or "no such file or directory": it was built for glibc. Check with ldd, then rebuild it or use gcompat.

  3. Stage 3

    Run with Compose

    Several services together: names, ports and networks.

    1. 9

      Tool

      Docker Compose Generator

      Pick your services and get a ready-to-run docker-compose.yml with healthchecks, volumes and a .env file.

    2. 10

      Article

      Docker: "connection refused" to localhost from a container — how to reach the host

      Fix "connection refused" when a container connects to localhost: use host.docker.internal or a Compose service name, make the host service listen, and check the firewall.

    3. 11

      Article

      Docker "port is already allocated" and "ports are not available": find who has the port

      Fix Docker "Bind for 0.0.0.0:8080 failed: port is already allocated" and "Ports are not available": find the container or process using it, and Windows reserved ports.

  4. Stage 4

    In production

    Containers that get killed, and a way to find the cause of any that won't run.

    1. 12

      Article

      Docker "exited with code 137": OOM kill or a stop that took too long

      Exit code 137 means the container was killed with SIGKILL. Find out if it ran out of memory or ignored docker stop, and fix each case.

    2. 13

      Guide

      Docker container won't start? Find the cause, step by step

      An error from docker run, a container that exits, or one that can't reach anything.

Your progress is saved in this browser only, never sent anywhere. Clearing the browser data clears it too.

All learning paths →