Interview Prep/Docker/Build failures and cache problems

`docker build` succeeds, but the image runs old code.

IntermediateTroubleshootingBuild failures and cache problems
Answer

Likely causes → The container was not recreated, a different tag is running, cache reused a stale COPY layer (rare), or Compose image: pulls an older tag.

Diagnose →

docker images --digests app
docker inspect -f '{{.Image}}' running_container

Fix → docker compose up -d --build --force-recreate; tag explicitly.

Prevent → Deploy by digest/immutable tags.

All Docker questions Roadmap: Docker & containers

More on Build failures and cache problems