Tho*_*zco 21
Docker中的图像没有名称,它们有标签.
标签是对图像的引用.多个标签可以指代相同的图像.
如果重新分配已使用的标记,则原始图像将丢失标记,但将继续存在(它仍可通过其图像ID访问,其他标记可能会引用它).
无法覆盖格式相同名称的 docker 镜像,但如果为镜像name:tag设置标签,则可以在构建后自动删除它:my-labelmy-image:latest
docker build --tag my-image:latest --label my-label ubuntu:latest
docker image prune --force --filter='label=my-label'
Run Code Online (Sandbox Code Playgroud)
更新:必须遵循严格的顺序:
docker build ...docker image prune ..docker build ...docker image prune ..如果你运行:
docker build ...
docker image prune ..
docker build ...
docker build ...
docker image prune ..
您将获得步骤 3 中未删除的图像。
| 归档时间: |
|
| 查看次数: |
10776 次 |
| 最近记录: |