Cloud & Container Security · beginner · ~11 min
Explain containers vs VMs and the common image/Dockerfile risks.
Containers package an app and share the host kernel (thinner isolation than VMs). An image is a read-only layered template; a container is a running instance. Top risks: secrets baked into image layers, outdated/large or untrusted base images, and running as root. Fix: no baked secrets, minimal pinned bases, non-root USER, image scanning.
Containers are everywhere, and most findings are image-build hygiene — baked secrets persist in layers, root containers worsen breakouts, and untrusted bases are a supply-chain risk. These are quick wins to find and fix.
Image vs container. Read-only layers vs running instance. Baked secrets. Persist in layers (docker history) — never bake. Base images. Minimal, pinned, trusted; scan. Non-root USER. Limit breakout impact. Build-arg leaks. Avoid secrets in ARG/history.
Containers package an app with its dependencies and run as isolated processes sharing the host kernel — lighter than VMs, but with a thinner isolation boundary.
An image is a read-only template (layers); a container is a running instance of it. Images come from registries (Docker Hub, private registries).
ENV/COPY of a key or .env persists in image layers even if "removed" later — anyone pulling the image extracts it. Use build secrets / runtime injection, never bake secrets.USER.latest from unknown sources (supply chain). Pin digests, use trusted bases.ARG can persist in history.Pull and inspect images (docker history, layer extraction) for secrets and sensitive files; check whether containers run as root; review Dockerfiles for the above. Most container findings are image-build hygiene.
No secrets in images, minimal pinned base images, non-root user, image scanning in CI, and read-only/limited containers at runtime.
Containers share the host kernel, so image hygiene matters: never bake secrets (they live in layers), use minimal pinned trusted bases, run as non-root, and scan images. Most container findings are build-time mistakes.