Docker slike so zgrajene v plasteh — vsak Dockerfile ukaz ustvari plast, in Docker predpomni plasti, da pospeši ponovne gradnje. Razumevanje plasti in predpomnilnika je ključno za pisanje učinkovitih Dockerfile-ov, ki se gradijo hitro in proizvajajo manjše slike.
Plasti — vsak ukaz doda plast
Each Dockerfile instruction (FROM, RUN, COPY, etc.) creates a read-only LAYER:
→ layers stack to form the image; layers are CACHED and SHARED between images
→ if a layer is unchanged, Docker REUSES the cached layer (skips rebuilding it)
→ Layer caching makes rebuilds fast — only changed layers (and those AFTER) rebuild.
