| 方式 | registry 缓存(mode=max 含中间层)、inline(随镜像附带,能力有限)、CI 平台缓存后端 |
|---|---|
| 命令 | docker buildx build --cache-from type=registry,ref=... --cache-to type=registry,ref=...,mode=max |
| 平台 | GitHub Actions 可用 --cache-to type=gha |
registry 缓存
registry 缓存
docker buildx build \
--cache-from type=registry,ref=registry.example.com/app:buildcache \
--cache-to type=registry,ref=registry.example.com/app:buildcache,mode=max \
-t registry.example.com/app:1.8.0 --push .缓存导出体积可观:registry 侧为缓存镜像设置独立的清理策略。