Ad · 728×90 desktop · 320×50 mobile

Containerization pitfalls everyone hits

Published 2026-04-24 · Kubernetes

Moving to containers is a multi-week journey. Here are the pitfalls that every team hits, ranked by impact.

1. Secrets in the image

People build images with config files containing credentials. Pushed to the registry. Leaked. Fix: external secrets (Secrets Manager, Vault) mounted at runtime.

2. State in the container

Containers are ephemeral. If your app stores state locally (uploads, caches), it's lost on restart. Fix: external state (database, S3, Redis).

3. Single huge image

Base image + 500 MB of dependencies + 2 GB of application code. Slow pulls. Long deploys. Fix: multi-stage builds, minimal base images (Alpine, distroless).

4. Running as root

Default for many runtimes. Serious security issue in Kubernetes. Fix: non-root user in Dockerfile, readOnlyRootFilesystem in pod spec.

5. No resource limits

Container eats all the node's memory. Other containers OOM. Fix: CPU and memory limits on every deployment.

6. Bad signal handling

Container receives SIGTERM on shutdown but doesn't handle it. Gets force-killed after 30s grace period. In-flight requests dropped. Fix: handle SIGTERM in the app, drain connections.

7. Health checks that lie

Liveness probe returns 200 but the app is deadlocked. Kubernetes can't know. Fix: health checks that actually test the critical paths.

8. Logs to files

App writes logs to /var/log/app.log. Container crashes. Logs gone. Fix: stdout/stderr only.

9. Stateful sets treated like deployments

Database pods treated as stateless. Restart = data loss. Fix: StatefulSets with persistent volumes and ordered termination.

10. Ignoring the image cache

Every build rebuilds from scratch. 10-minute builds. Fix: layer caching via BuildKit, efficient Dockerfile ordering.

Tools

Ad · 300×250 responsive

Joined by engineers at enterprises running the systems you build. No spam. No tracking in the emails.