Interview Prep/Docker/Multi-stage builds, cache, tags and registries

When do you use `--no-cache` and when is it a smell?

BeginnerScenarioMulti-stage builds, cache, tags and registries
Answer

Situation read → It forces every layer to be rebuilt.

What I'd do → Use it occasionally (weekly scheduled build) to pull in OS security updates when you do not pin packages, or when debugging cache poisoning. As a default in CI it is a smell: it hides poor layer ordering and slows everything.

Why → Better: bump a build ARG such as CACHE_BUST at a chosen layer, or use --pull to refresh the base.

Interview tip → --pull and --no-cache solve different problems.

All Docker questions Roadmap: Docker & containers

More on Multi-stage builds, cache, tags and registries