Docker Container Errors — Exit Codes, OOMKilled, and Networking Issues
Errordocker
Overview
Fix Docker container errors including non-zero exit codes, OOMKilled, DNS resolution inside containers, port binding conflicts, and volume permission issues.
Key Details
- Docker exit codes indicate why a container stopped: 0 (success), 1 (app error), 137 (killed/OOM), 139 (segfault)
- OOMKilled occurs when a container exceeds its memory limit set by --memory flag or system OOM
- DNS resolution inside containers uses Docker's embedded DNS server (127.0.0.11)
- Port binding fails if the host port is already in use by another process or container
- Volume permissions issues arise when container user UID does not match host file ownership
Common Causes
- Container running out of memory (OOMKilled with exit code 137)
- Application crash inside the container (exit code 1, check container logs)
- Port conflict: host port already bound by another container or host process
- DNS resolution failing inside container due to Docker network misconfiguration
- Volume mount permissions: container process runs as different UID than host file owner
Steps
- 1Check container status: docker ps -a to see exit codes of stopped containers
- 2View container logs: docker logs <container_id> --tail 100
- 3Check if OOMKilled: docker inspect <container_id> | grep OOMKilled
- 4Fix port conflicts: docker port <container> to see port mappings, or change host port
- 5Fix DNS: add --dns 8.8.8.8 to docker run or configure /etc/docker/daemon.json
- 6Fix volume permissions: match container user UID with host UID, or use --user flag in docker run
Tags
dockercontainerexit-codeoomkillednetworking
Related Items
More in Docker
linux-docker-common-errorsLinux Docker Common Errors — Container, Network & Volume Troubleshooting
Errorlinux-container-permission-namespaceLinux Container Permission Errors — User Namespaces and Rootless Containers
Warninglinux-kubernetes-pod-crashloopbackoffKubernetes CrashLoopBackOff — Pod Restart Loop and Container Crash Debugging
Errorlinux-kubernetes-pod-imagepullbackoffKubernetes ImagePullBackOff — Container Image Download and Registry Errors
Errorlinux-docker-compose-network-errorDocker Compose Network Errors — Container Communication and DNS Resolution Failures
WarningFrequently Asked Questions
Exit code 137 means the process was killed by signal 9 (SIGKILL). Usually this is the OOM killer terminating the process for exceeding memory limits. Increase --memory or optimize the application.