Linux Docker Common Errors — Container, Network & Volume Troubleshooting
About Linux Docker Common Errors
Fix common Docker errors including 'no space left on device', 'port already allocated', 'permission denied', DNS failures, and container networking issues. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: Docker errors span containers, images, networks, volumes, and the daemon itself. Storage: Docker uses /var/lib/docker which can fill up with unused images and containers. Network: Docker creates its own network namespaces and bridge interfaces. Permissions: Docker daemon runs as root, but container processes may not. Common errors include exit codes: 0 (success), 1 (app error), 137 (OOM killed), 139 (segfault). Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: Docker storage full from accumulated images, containers, and volumes. Port conflict: host port already in use by another container or service. DNS not working inside containers (resolv.conf not configured). Permission denied when mounting host volumes into containers. Container OOM killed (exit code 137) due to memory limit. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Clean up storage: docker system prune -a --volumes (removes ALL unused data). Check port usage: docker ps --format '{{.Ports}}' and lsof -i :PORT. Fix DNS in containers: add --dns=8.8.8.8 to docker run or configure daemon.json. Fix volume permissions: use -u $(id -u):$(id -g) or set proper ownership inside container. Check OOM kills: docker inspect CONTAINER --format='{{.State.OOMKilled}}'. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What does exit code 137 mean?
Exit code 137 = 128 + 9 (SIGKILL). Usually means the container was OOM-killed for exceeding its memory limit.
Overview
Fix common Docker errors including 'no space left on device', 'port already allocated', 'permission denied', DNS failures, and container networking issues.
Key Details
- Docker errors span containers, images, networks, volumes, and the daemon itself
- Storage: Docker uses /var/lib/docker which can fill up with unused images and containers
- Network: Docker creates its own network namespaces and bridge interfaces
- Permissions: Docker daemon runs as root, but container processes may not
- Common errors include exit codes: 0 (success), 1 (app error), 137 (OOM killed), 139 (segfault)
Common Causes
- Docker storage full from accumulated images, containers, and volumes
- Port conflict: host port already in use by another container or service
- DNS not working inside containers (resolv.conf not configured)
- Permission denied when mounting host volumes into containers
- Container OOM killed (exit code 137) due to memory limit
Steps
- 1Clean up storage: docker system prune -a --volumes (removes ALL unused data)
- 2Check port usage: docker ps --format '{{.Ports}}' and lsof -i :PORT
- 3Fix DNS in containers: add --dns=8.8.8.8 to docker run or configure daemon.json
- 4Fix volume permissions: use -u $(id -u):$(id -g) or set proper ownership inside container
- 5Check OOM kills: docker inspect CONTAINER --format='{{.State.OOMKilled}}'