open atlas
↑ Back to track
Deployment & Infra DEP · 01 · 08

Image layers: free-recall review

Free-recall prompts across the image-layers unit. Answer each in your own words first, then reveal the model answer and compare.

DEP Senior ◷ 14 min
Level
FoundationsJuniorMiddleSenior

Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what makes the mechanism stick when you are reviewing a real Dockerfile.

Goal

Reconstruct the unit’s core mechanisms — the cache as a content-keyed prefix, the order rule, multi-stage slimming, base-image tradeoffs, and the immutable-layer secret trap — without looking back at the lesson.

Recall before you leave
  1. 01
    What exactly is a Docker image layer, and what two inputs does the build cache key each layer on?
  2. 02
    State the cardinal ordering rule and explain why putting COPY . . before RUN npm ci wrecks build times.
  3. 03
    Why does 'RUN apt-get update' followed by a separate 'RUN apt-get install' serve stale packages, and how do you fix it?
  4. 04
    How does a multi-stage build shrink an image, and roughly what size deltas should you expect?
  5. 05
    Compare distroless and alpine as final-stage bases — when do you reach for each?
  6. 06
    Why does deleting a secret in a later layer not remove it, and what should you do instead?
Recap

If you could reconstruct each answer from memory, you hold the unit’s spine: a layer is a content-keyed diff, the cache is a strict prefix, RUN is keyed on text not effect, ordering least- to most-changing keeps the expensive install cached, multi-stage builds compile fat and ship slim, distroless trades the shell for a minimal attack surface, and a secret added then rm’d lives forever in an earlier layer — so it must never become a layer at all. Now when you face a Dockerfile in the wild, these six answers are the checklist you run before you approve or merge.

Something unclear?

Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.

shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.