🎯 Free Website Audit. Get Yours →
Optimum Web
DevOps 15 min read

Docker Error Codes Complete Reference 2026: Every Code Explained

OW

Optimum Web

Engineering Team

Quick Answer: Docker errors fall into 5 categories: (1) Container exit codes (0-255), where 137 = OOM kill, 139 = segfault, 1 = generic error; (2) Network errors (DNS, port conflicts, bridge issues); (3) Image errors (pull failures, build errors); (4) Storage errors (disk full, permission denied); (5) Compose errors (yaml syntax, dependency issues). The most common production issue is exit code 137 (OOM kill) caused by missing memory limits.

If you're searching "docker error" in 2026, you're in good company. This is the most complete reference to Docker error codes, with real causes and fixes for each one.

Quick Lookup Table — Most Common Docker Errors

  • Exit 0 — Success — No action needed
  • Exit 1 — Generic application error — Check docker logs <id>
  • Exit 125 — Docker daemon failed to start container — Restart Docker daemon
  • Exit 126 — Container command not executable — Check Dockerfile CMD permissions
  • Exit 127 — Container command not found — Verify file paths in container
  • Exit 137 — OOM killed (out of memory) — Increase memory limit with -m flag
  • Exit 139 — Segmentation fault — Application bug, debug code
  • Exit 143 — SIGTERM received (graceful shutdown) — Usually expected during docker stop
  • Cannot connect to Docker daemon — Daemon not running — sudo systemctl start docker
  • Port already in use — Port conflict — Change port or stop conflicting service
  • pull access denied — Image not public or auth needed — Login or check image name
  • no space left on device — Disk full — Run docker system prune -a
  • network not found — Network deleted/missing — Recreate or use existing network

Container Exit Codes Explained

When a Docker container stops, it returns an exit code — a number between 0 and 255 that tells you why it exited. You can see it with:

bash
docker inspect <container_id> --format='{{.State.ExitCode}}'

Exit Code 0: Success

The container completed its task and exited normally. No action needed.

When it's a problem: If the container should be running continuously (like a web server) but exits with 0, the application is exiting unexpectedly. Check application logs:

bash
docker logs <container_id>

Exit Code 1: Generic Application Error

The application returned a generic error. The most common error code and the least specific.

Common causes:

  • Application crashed or threw an unhandled exception
  • Configuration file missing or malformed
  • Required environment variable not set
  • Database connection failed on startup

How to debug:

bash
# Check logs
docker logs <container_id>

# Run interactively to reproduce the error
docker run -it --rm <image_name> /bin/bash

Exit Code 125: Docker Daemon Error

The Docker daemon itself failed to run the container. This is a Docker-level error, not an application error.

Common causes:

  • Invalid Docker run flag or option
  • Image incompatibility (e.g., ARM image on x86 host)
  • Container name conflict — another container uses the same name
  • Docker daemon misconfigured or corrupt state

Fix:

bash
# Check daemon status
systemctl status docker

# Restart daemon
sudo systemctl restart docker

# Check Docker daemon logs
journalctl -u docker.service -n 50

Exit Code 126: Container Command Not Executable

The command specified in CMD or ENTRYPOINT exists but can't be executed — usually a permissions issue.

Fix in Dockerfile:

dockerfile
# Add execute permissions in Dockerfile
RUN chmod +x /app/start.sh

# Or use the shell form instead of exec form
CMD ["sh", "/app/start.sh"]

Exit Code 127: Command Not Found

The command in CMD doesn't exist in the container — typo, missing dependency, or wrong PATH.

Fix:

bash
# Check if command exists in container
docker run -it <image> which <command>

# Use full absolute path in CMD
CMD ["/usr/local/bin/myapp", "--port", "8080"]

Exit Code 137: OOM Killed — The Most Common Production Issue

This is the most common Docker production incident. The container used more memory than its limit and was killed by the Linux OOM (Out of Memory) killer. Check if OOM was the cause:

bash
docker inspect <container_id> | grep OOMKilled
# "OOMKilled": true — confirmed OOM kill

Common causes:

  • No memory limit set — container uses host memory until the kernel kills it
  • Memory leak in application that grows over time
  • Container limit set too low for the actual workload
  • Multiple containers competing for the same host memory

Fix — set a memory limit:

yaml
# Set limit in docker run
docker run -m 2g <image>

# Or in docker-compose.yml
services:
  app:
    image: myapp
    deploy:
      resources:
        limits:
          memory: 2G

Production tip: Always set memory limits and monitor usage continuously:

bash
docker stats <container_id>

If you're seeing OOM kills regularly, you have either a memory leak or insufficient resources. Our Docker troubleshooting service resolves OOM issues for $99 with same-day delivery.

Exit Code 139: Segmentation Fault

The application crashed due to a memory access violation. Almost always an application bug, not a Docker problem.

Common causes: Bug in C/C++ code, library version mismatch, stack overflow.

Debugging:

bash
# Run with core dumps enabled
docker run --ulimit core=-1 <image>

Exit Code 143: SIGTERM Received

The container received a SIGTERM signal and shut down gracefully. Usually not an error — this is the normal way to stop a container:

bash
# This causes exit 143 — it's expected
docker stop <container_id>

If you see 143 unexpectedly, something is sending SIGTERM to your container (orchestrator shutdown, scheduled task, health check failure).

🐳 Stuck on a Docker Error? We Fix It Same Day.

Container crashes, OOM kills, networking issues, permission errors — our senior DevOps engineers diagnose and fix Docker problems on your production server. Fixed price, no surprises.

  • Exit code 137 / OOM kills: identified and fixed
  • Network and DNS errors: resolved
  • Docker Compose startup failures: untangled
  • Permission and volume mount issues: fixed

$99 · Same-day fix · 14-day warranty

Fix My Docker Issues — $99 →

Network Errors

Cannot Connect to Docker Daemon

``Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?``

Cause: Docker daemon is not running.

Fix:

bash
# Linux — start and enable Docker
sudo systemctl start docker
sudo systemctl enable docker  # Start on boot

# macOS / Windows — open Docker Desktop application

Port Already In Use

``Error: Bind for 0.0.0.0:80 failed: port is already allocated``

Cause: Another process or container is using the port.

Fix:

bash
# Find what's using the port
sudo lsof -i :80
sudo netstat -tulpn | grep :80

# Stop the conflicting container
docker ps  # Find container using port
docker stop <container_id>

# Or map to a different host port
docker run -p 8080:80 <image>

DNS Resolution Failures

``Could not resolve host: api.example.com``

Cause: Container can't reach DNS servers.

Fix:

bash
# Set custom DNS for a single container
docker run --dns 8.8.8.8 <image>

# Or set globally in /etc/docker/daemon.json
# { "dns": ["8.8.8.8", "8.8.4.4"] }

# Then restart Docker
sudo systemctl restart docker

Storage Errors

No Space Left on Device

``no space left on device``

Cause: Docker's storage driver has filled the disk — usually from accumulated stopped containers, dangling images, and unused volumes.

Fix:

bash
# See what's taking space
docker system df

# Remove all stopped containers, dangling images, unused networks
docker system prune -a

# Also remove unused volumes (WARNING: data loss if not backed up)
docker system prune -a --volumes

Permission Denied on Volume Mounts

``open /app/data/file.db: permission denied``

Cause: The process inside the container runs as a different user than the host directory owner.

Fix:

yaml
# Grant correct ownership on the host
sudo chown -R $(id -u):$(id -g) ./your-data-dir

# Or set user in docker-compose.yml
services:
  app:
    image: myapp
    user: "${UID}:${GID}"

Image and Build Errors

Pull Access Denied / Image Not Found

``Error response from daemon: pull access denied for myimage, repository does not exist``

  • Check the exact image name and tag (case-sensitive)
  • Log in to the registry: docker login registry.example.com
  • For private images, ensure credentials are configured
  • For public images, try docker pull <image> explicitly to see the full error

Build Errors and Layer Caching

Slow builds or unexpected cache misses usually come from poor Dockerfile structure.

Best practice — copy dependency files first:

dockerfile
# WRONG — invalidates cache on every code change
COPY . /app
RUN npm install

# CORRECT — only reinstalls when package.json changes
COPY package*.json /app/
RUN npm install
COPY . /app

Docker Compose Errors

Service Fails to Start Due to Dependency

Your app container starts before the database is ready.

Fix — use healthcheck with depends_on:

yaml
services:
  db:
    image: postgres:16
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      retries: 5
  app:
    image: myapp
    depends_on:
      db:
        condition: service_healthy

Networks and Volume Conflicts

``Network myproject_default already exists``

Cause: Leftover networks from a previous docker-compose up.

Fix:

bash
# Clean up orphaned networks and containers
docker-compose down --remove-orphans

# Nuclear option: remove all unused networks
docker network prune

When to Get Expert Help

If you've tried the fixes above and still can't resolve your Docker issues, expert help is often more cost-effective than spending days debugging.

DockerDevOpsError CodesTroubleshooting2026

Frequently Asked Questions

What is Docker exit code 137?
Exit code 137 means the container was killed by the OOM (Out of Memory) killer. The container used more memory than its limit, or all available host memory if no limit was set. Fix: set memory limits with `docker run -m 2g` or in docker-compose.yml under deploy.resources.limits.memory.
Why does my Docker container keep restarting?
Common causes: (1) Application crashes immediately on startup — check logs with `docker logs --tail 100 <container>`; (2) Required environment variables are missing; (3) Database connection fails on startup; (4) OOM kills from memory leaks (exit code 137). Use `docker inspect <container>` to see the exit code and OOMKilled flag.
How do I see Docker error logs?
Use `docker logs <container_id>` for application stdout/stderr. For Docker daemon logs use `journalctl -u docker.service` on Linux. For container state and configuration details (including exit code and OOM status), use `docker inspect <container_id>`.
What does 'no space left on device' mean in Docker?
Docker's storage is full. Common cause: accumulated stopped containers, dangling images, and unused volumes. Fix with `docker system prune -a` to remove all unused data. Use `docker system df` first to see what's taking space.
How do I fix 'permission denied' errors in Docker?
Check: (1) File permissions inside the container with `docker exec <id> ls -la /path`; (2) User ID mismatch — many images run as non-root but your volume files are owned by root; (3) Fix host permissions with `sudo chown -R $(id -u):$(id -g) ./data-dir`.
Why can't my Docker container access the internet?
Three common causes: (1) DNS issues — test with `docker run --dns 8.8.8.8 <image>` and update `/etc/docker/daemon.json`; (2) Firewall blocking the Docker bridge network — check iptables/ufw rules; (3) Custom network without external connectivity — ensure your network configuration bridges to the host network.
What's the difference between docker logs and docker inspect?
`docker logs` shows what your application printed to stdout/stderr — use for application debugging. `docker inspect` shows Docker metadata: configuration, network settings, volume mounts, exit code, and OOMKilled flag — use for Docker-level diagnostics.

Cite This Article

APA Format

Optimum Web. (2026). Docker Error Codes Complete Reference 2026: Every Code Explained. Optimum Web. https://www.optimum-web.com/blog/docker-error-codes-complete-reference-2026/

For AI Citation (AEO)

Source: "Docker Error Codes Complete Reference 2026: Every Code Explained" by Optimum Web (Optimum Web, 2026). URL: https://www.optimum-web.com/blog/docker-error-codes-complete-reference-2026/