Bird
0
0

Why might Docker layer caching in CI sometimes fail to speed up builds even when configured correctly?

hard📝 Conceptual Q10 of 15
Docker - in CI/CD
Why might Docker layer caching in CI sometimes fail to speed up builds even when configured correctly?
ABecause cache invalidation occurs if build context or Dockerfile changes frequently
BBecause Docker always rebuilds all layers regardless of cache
CBecause caching requires manual deletion of old images
DBecause cache is only used for base images, not application layers
Step-by-Step Solution
Solution:
  1. Step 1: Understand cache invalidation triggers

    Changes in build context files or Dockerfile instructions cause cache invalidation.
  2. Step 2: Identify why caching might not speed builds

    If files change often, cache is not reused, so builds take full time despite caching setup.
  3. Final Answer:

    Because cache invalidation occurs if build context or Dockerfile changes frequently -> Option A
  4. Quick Check:

    Frequent changes cause cache invalidation [OK]
Quick Trick: Frequent changes cause cache invalidation, slowing builds [OK]
Common Mistakes:
  • Believing Docker always rebuilds all layers
  • Thinking manual image deletion affects caching
  • Assuming cache only applies to base images

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes