Software & Applications

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.

Docker container logs and diagnostic terminal in a homelab environment
Docker container logs and diagnostic terminal in a homelab environment

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:

Read-only Docker inspection commands
docker ps -a
docker inspect --format='{{.State.Status}} | ExitCode={{.State.ExitCode}} | OOMKilled={{.State.OOMKilled}}' <container>
docker logs --tail 100 --timestamps <container>
Symptom or Exit CodeLikely CauseFirst Fix to Check
OOMKilled=true (Exit 137)Container exceeded memory or host RAMCheck free -h, raise mem_limit, or add swap
Exit 1 right at startupMissing .env variable or invalid config syntaxCompare docker compose config against docs
Permission denied in logsHost volume owned by root vs container PUID/PGIDMatch chown on host folder or set user:
Bind for 0.0.0.0:8080 failedAnother container or host daemon uses that portRun ss -lntp and remap the host port
Connection refused between appsContainer tries to reach localhost instead of service namePut 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.

  1. Check the numeric UID/GID expected by the image (PUID/PGID environment variables or user: directive).
  2. Inspect the host folder ownership with ls -ln /path/to/data.
  3. Align ownership cleanly instead of running chmod 777 across 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’s DB_HOST to db, not 127.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:
Test internal Docker DNS and port reachability
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.

Automation & Infrastructure Desk

Think Tech Editorial

Engineering guides focused on reliable self-hosted workflows, reverse proxies, and production diagnostics.