Docker Remove Image:如何删除Docker镜像示例

本文介绍了如何删除Docker的悬空和未使用镜像,以释放本地机器的空间。通过示例展示了如何查找和删除这两种类型的镜像,以及如何使用`prune`命令清理所有过时的Docker镜像。对于生产环境,建议使用Container Registry解决方案来管理Docker镜像。
摘要由CSDN通过智能技术生成

We live in an era where storage is becoming cheaper everyday. We can just send everything to the cloud and pay almost nothing.

我们生活的时代每天都在变得越来越便宜。 我们可以将所有内容发送到云中,而几乎不支付任何费用。

So why would we need to worry about deleting Docker images?

那么,为什么我们要担心删除Docker映像呢?

First of all, there are still some mission critical workloads that can't be moved to the cloud, especially those in heavily regulated industries like law or healthcare.But to better answer that question, I would say that we as developers often find ourselves out of space on our local machines.

首先,仍然有一些关键任务工作负载无法转移到云中,特别是在法律或医疗保健等受严格监管的行业中。但是为了更好地回答这个问题,我想说我们作为开发人员经常会发现自己我们本地机器上的空间。

Let's do a quick analysis of this StackOverflow public dataset to explore that further:

让我们对这个StackOverflow公开数据集进行快速分析,以进一步探索它:

SELECT tag,
       title,
       answer_count,
       favorite_count,
       score,
       view_count VIEWS
FROM
  (SELECT title,
          answer_count,
          favorite_count,
          view_count,
          score,
          SPLIT(tags, '|') tags
   FROM `bigquery-public-data.stackoverflow.posts_questions` 
         posts_questions), UNNEST(tags) tag
WHERE tag = 'docker'
  AND title LIKE '%space left%'
ORDER BY VIEWS DESC

Query Results:

查询结果:

So it does't happen just with me, right? Look at how many views we have on those StackOverflow posts. If you are wondering, the number is 465687 views for posts matching the search query.

所以这不仅仅发生在我身上,对吗? 看看我们对那些StackOverflow帖子有多少意见。 如果您想知道,与搜索查询匹配的帖子的查看次数为465687

Luckily for us, today we are going to see some easy-to-use examples on how to delete our dangling and unused docker images to help ourselves out.

对我们来说幸运的是,今天我们将看到一些易于使用的示例,这些示例说明了如何删除悬空和未使用的docker映像以帮助自己。

什么是悬空的和未使用的Docker映像? (What are dangling and unused Docker images?)

drawing

What is the difference between dangling and unused images, you mi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值