Docker强制删除镜像

场景

在服务器上使用Docker打包成容器来跑服务时,应为磁盘原因要删除不要或者异常的镜像。

删除

查看所以的镜像 docker images -a

REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
<none>       <none>    40a77735e6d8   6 months ago   643MB
<none>       <none>    1dfac08bf90f   6 months ago   643MB
<none>       <none>    51fb2ad8ab7b   6 months ago   643MB
<none>       <none>    5b46d0b73619   6 months ago   643MB
<none>       <none>    3f763ddfd2e3   6 months ago   643MB
<none>       <none>    91198512cb38   6 months ago   643MB
<none>       <none>    bfe44cd4545e   6 months ago   643MB
<none>       <none>    73f98df6169a   6 months ago   643MB
<none>       <none>    ca684730863b   6 months ago   643MB
<none>       <none>    2331606985b1   6 months ago   643MB
<none>       <none>    37d15734ac63   6 months ago   643MB
<none>       <none>    3b67601f31e4   6 months ago   643MB
<none>       <none>    02aaa36e210f   6 months ago   643MB
<none>       <none>    77ba70c0bc09   6 months ago   643MB
<none>       <none>    0af1b42d4e1e   6 months ago   643MB
<none>       <none>    c1a415ae226a   6 months ago   643MB
<none>       <none>    a6809ae60385   6 months ago   643MB
<none>       <none>    86ae730a4e09   6 months ago   643MB
<none>       <none>    94849045b0f9   6 months ago   643MB
<none>       <none>    d7d939e00406   6 months ago   643MB
<none>       <none>    f74e4999174f   6 months ago   643MB
<none>       <none>    32c9919b50af   6 months ago   643MB

首先直接使用docker rmi 镜像号 删除,但是会报删除镜像异常,异常信息如下:

Deleted: sha256:73f98df6169a91150fcf1448143bf9d762b9a96e1e7094634ac7c03fdef7bbe9
Deleted: sha256:f74e4999174fa9bb5281497ff45564218c1e1cb6bdc56b4465b3a19ba0788e70
Error response from daemon: conflict: unable to delete ca684730863b (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete 77ba70c0bc09 (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete 3b67601f31e4 (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete 02aaa36e210f (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete 94849045b0f9 (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete d7d939e00406 (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete 86ae730a4e09 (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete d23bdf5b1b1b (cannot be forced) - image has dependent child images
Error response from daemon: conflict: unable to delete d23bdf5b1b1b (cannot be forced) - image has dependent child images

最后通过在后面加入强制删除 --force后成功删除,命令如下:

docker rmi 镜像号 --force

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值