Docker Fixes
18 troubleshooting guides — each with the error, why it happens, and copy-paste commands to fix it.
- Docker Container Exits With Code 137 (OOM Killed) — Exit code 137 means your container received SIGKILL — either the host OOM killer or a cgroup memory limit took it down.
- Docker: 'No Space Left on Device' (and How to Reclaim It Safely) — Docker eats disk via dangling images, dead containers, and unbounded log files.
- Docker Compose Containers Can't Reach Each Other — Compose services talk over a shared network using service names as hostnames.
- Docker: 'Permission Denied While Trying to Connect to the Docker Daemon Socket' — Your user can sudo but can't talk to the Docker daemon without it.
- Docker: 'Bind: Address Already in Use' — Something is already listening on the host port you published.
- Docker Container Exits Right After Starting — The container starts, runs for a second, and dies with no obvious error.
- Docker Compose: depends_on Doesn't Wait for "Ready" — Healthcheck Ordering — Plain depends_on only orders container START, not readiness — the DB starts before your app and still refuses connections.
- Docker: "exec /bin/sh: Exec Format Error" — Wrong Architecture Image — The image's CPU architecture doesn't match the host: amd64 image pulled on an ARM64 machine (or the reverse).
- "Cannot connect to the Docker daemon" — Daemon Down or Permissions — The CLI can't reach dockerd: either the daemon isn't running, your user lacks socket access, or the DOCKER_HOST points somewhere wrong.
- Docker Network Errors: "Endpoint Already Exists" / Sandboxes Left Behind — Docker's per-network bookkeeping gets stuck after failed restarts: containers half-exist in the network sandbox.
- Docker: "Driver Failed Programming External Connectivity on Endpoint" — Docker couldn't wire up the port publish when starting the container: usually the port is taken, iptables is in a bad state, or a stale endpoint from a previous run blocks the name.
- Dockerfile "COPY Failed: File Not Found" — Context, Not Paths — COPY/ADD can't find the file because Docker resolves paths against the build context, not the Dockerfile's directory or your shell's cwd.
- Docker Compose Ignoring Your Environment Variables — Three different mechanisms pass env vars (interpolation, .
- docker push: "Requested Access to the Resource Is Denied" — You're authenticated, but as the wrong user or against the wrong repo path.
- Docker Compose: "Network Has Active Endpoints" — Force-Minus-Danger — Compose won't remove a network while containers (including orphans from other projects) still use it.
- Docker: "Conflict. The Container Name Is Already in Use" — A stopped (or running) container already holds the name — names are unique regardless of state.
- Docker Compose: "The Variable Is Not Set. Defaulting to a Blank String" — Compose warns when ${VAR} in the YAML has no value, then substitutes empty — which surfaces later as a broken image name, empty password, or skipped config.
- Docker: "Pull Access Denied" — Registry Auth, Names, and Rate Limits — The registry refused the pull: not authenticated, the image name is wrong (the classic missing namespace), or the Hub rate limit hit.