Container image layers

컨테이너 이미지 레이어

Build an image as reusable layers produced by successive instructions.

···
html
<div class="stage" data-phase="0"><div class="title">IMAGE BUILD CACHE</div><div class="layers"><div class="panel">BASE <span>cached</span></div><div class="panel">DEPENDENCIES <span>cached</span></div><div class="panel app">APP CODE <span>cached</span></div></div><div class="sub">change: app source</div></div>
css
.stage{width:min(94vw,760px);height:min(88vh,330px);padding:clamp(9px,2.6vmin,20px);border:1px solid var(--line);border-radius:14px;background:var(--surface);font:600 clamp(12px,2.5vmin,16px)/1.3 "Pretendard Variable",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",sans-serif;display:flex;flex-direction:column;gap:clamp(6px,1.7vmin,12px);overflow:hidden;position:relative}.stage *{min-width:0}.stage .title{color:var(--accent);font-weight:800}.stage .sub{color:var(--muted)}.stage .row{display:flex;align-items:center;gap:clamp(5px,1.6vmin,12px)}.stage .panel{border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:clamp(6px,1.6vmin,12px)}.stage .mono{font-family:ui-monospace,SFMono-Regular,monospace;font-size:clamp(12px,2.5vmin,15px)}.stage .grow{flex:1}.stage .on{color:var(--accent)}.layers{display:flex;flex-direction:column-reverse;justify-content:center;gap:clamp(4px,1vmin,8px);flex:1}.layers .panel{display:flex;justify-content:space-between}.layers span{color:var(--accent)}.stage[data-phase="1"] .app{border-color:var(--accent-3);transform:translateX(7px)}.stage[data-phase="1"] .app span{font-size:0;color:var(--accent-3)}.stage[data-phase="1"] .app span:after{content:'rebuilding';font-size:clamp(12px,2.5vmin,16px)}.stage[data-phase="2"] .app{background:color-mix(in srgb,var(--accent) 16%,var(--surface));border-color:var(--accent)}
js
const stage=document.querySelector('.stage');let phase=0;function advance(){phase=(phase+1)%3;stage.dataset.phase=String(phase)}const timer=setInterval(advance,1200);stage.addEventListener('pointerdown',()=>{clearInterval(timer);advance()})

A container image stacks filesystem changes from build instructions over a base image. Unchanged earlier inputs let the builder reuse cached layers.

The demo changes only application code: base and dependencies remain cached while the last layer rebuilds. Putting volatile steps early invalidates more of the cache.

When to use

Use it when ordering build instructions to reduce rebuild time and transferred changes.

Open as page ↗