docker-impl-build-optimization
Installation
SKILL.md
docker-impl-build-optimization
Quick Reference
Layer Caching Rules
Docker checks each instruction against its cache before executing. If the instruction and its inputs match a cached layer, the cached version is reused.
Critical rule: Once ANY layer's cache is invalidated, ALL subsequent layers MUST rebuild.
Cache Invalidation Triggers
| Instruction | Cache Key | Invalidation Trigger |
|---|---|---|
FROM |
Image reference | Base image tag/digest changed |
RUN |
Command string only | Command text changed (NOT external resources) |
COPY |
File content checksums | File content changed (mtime is NOT checked) |
ADD |
File checksums + URL content | File content or URL content changed |
ENV |
Key=Value pair | Value changed |
Related skills