容器镜像搬运与检查工具
crane 是 go-containerregistry 提供的命令行工具,直接操作 registry 中的镜像、manifest 和 layer,不需要 Docker daemon。适合 CI 中的复制、打标签和检查。
crane auth login registry.example.com -u user -p "$PASSWORD"
crane ls registry.example.com/app
crane digest registry.example.com/app:1.0
crane manifest registry.example.com/app:1.0
crane config registry.example.com/app:1.0
crane pull registry.example.com/app:1.0 app.tar
crane push app.tar registry.example.com/app:1.0
crane copy registry.example.com/app:1.0 registry.example.com/app:stable
crane tag registry.example.com/app:1.0 stable
crane delete registry.example.com/app:old
crane validate --remote registry.example.com/app:1.0
crane tag 和 crane copy 都会在 registry 产生新引用;确认目标仓库和权限。manifest 和取子平台清单不同。delete 只删指定 tag/清单,其他 tag 仍可能引用同一层;清理要确认引用关系。~/.docker/config.json 或 crane auth login。regctl — 另一款 registry 客户端docker-buildx — 构建镜像dive — 分析镜像层