Docker Troubleshooting for Homelabs: Fast Fix Playbook
Fix common homelab Docker issues systematically: inspect logs, exit codes, volume permissions, bridge networking, and DNS without wiping containers blindly.
When a self-hosted app refuses to start or disappears after an update, guessing at docker compose down and up rarely reveals why it broke. A calm, five-minute diagnostic sequence separates image bugs, permission mismatches, port conflicts, and Docker networking mistakes before you touch persistent data.
Start With Status, Exit Codes, and Logs
Every container leaves clear evidence when it crashes. Before editing your compose.yml, inspect the container’s exit code and last 100 log lines:
docker ps -a
docker inspect --format='{{.State.Status}} | ExitCode={{.State.ExitCode}} | OOMKilled={{.State.OOMKilled}}' <container>
docker logs --tail 100 --timestamps <container>| Symptom or Exit Code | Likely Cause | First Fix to Check |
|---|---|---|
OOMKilled=true (Exit 137) | Container exceeded memory or host RAM | Check free -h, raise mem_limit, or add swap |
Exit 1 right at startup | Missing .env variable or invalid config syntax | Compare docker compose config against docs |
Permission denied in logs | Host volume owned by root vs container PUID/PGID | Match chown on host folder or set user: |
Bind for 0.0.0.0:8080 failed | Another container or host daemon uses that port | Run ss -lntp and remap the host port |
Connection refused between apps | Container tries to reach localhost instead of service name | Put both services on the same Docker network |
Fix Volume Permission and Path Mistakes
Permission errors account for nearly half of homelab container failures—especially with media apps, Paperless-ngx, and databases. Inside a container, an application often runs as a non-root UID (such as 1000:1000 or 999:999), while the host directory you created with sudo mkdir belongs to root:root.
- Check the numeric UID/GID expected by the image (
PUID/PGIDenvironment variables oruser:directive). - Inspect the host folder ownership with
ls -ln /path/to/data. - Align ownership cleanly instead of running
chmod 777across sensitive data folders.
Also verify that you are using named volumes or explicit bind mounts for database directories. Anonymous volumes or missing mounts are the top reason configurations reset after recreating a container.
Debug Container-to-Container Networking and DNS
Inside Docker Compose, localhost inside Container A refers only to Container A itself—never to a database in Container B or a service on the host.
- Use Compose service names: If your Postgres service is named
db, point your app’sDB_HOSTtodb, not127.0.0.1. - Attach shared proxies explicitly: If Traefik, Caddy, or Nginx Proxy Manager sits in a separate Compose file, both stacks must attach to a shared external Docker bridge network.
- Test inside the failing container: Verify DNS resolution and port reachability directly from the app container rather than from the host shell:
docker exec -it <app-container> sh -c "getent hosts db && nc -zv db 5432"Prevent Disk Exhaustion From Dangling Images
Over months of updates, unused Docker images, stopped containers, and build caches silently fill small homelab SSDs until databases fail to write. Check docker system df monthly and prune unused images safely with docker image prune -f—never run docker volume prune without verifying what unattached volumes contain first.
Conclusion
Reliable Docker troubleshooting for homelabs comes down to reading exit codes and logs first, matching host volume permissions cleanly, connecting services over shared Docker networks by name, and keeping host disk space healthy.
Frequently Asked Questions
Why does my container lose its settings whenever I update it?
Its configuration directory is not mounted to a persistent host path or named Docker volume. Check the image documentation for the exact internal data path (such as /config or /app/data) and map it in compose.yml.
Is it safe to run docker system prune -a --volumes when troubleshooting?
Avoid --volumes during troubleshooting. Removing unused volumes can permanently delete databases or uploads belonging to any stopped container. Use docker image prune only after confirming which containers are running.
Why can one container not reach another by container name?
Docker’s embedded DNS only resolves service names on user-defined bridge networks, not the legacy default bridge network. Declare a named network in compose.yml or attach both stacks to a shared external network.