How to Remove All Docker Images

29/12/2020
Docker keeps a local copy of every Docker image you download. So, your Docker host may get congested at some point. All these Docker images will use quite a lot of disk spaces as well. What if you want to remove them all?

Well, the good news is, you can remove all the locally stored Docker images on your Docker host very easily. This is the topic of this article.

In this article, I am going to show you how to remove all the locally stored Docker images on your Docker host. I am also going to show you how to remove unused Docker images from your Docker host. So, let’s get started.

Requirements:

You must have Docker installed on your computer if you want to try out the examples in this article.

If you don’t have Docker installed, then you may check out one of the articles below (depending on your operating system) to get Docker installed on your desired Linux distribution.

If you still have any problem installing Docker, you may contact me through https://support.linuxhint.com. I will be more than happy to help.

Removing All Unused Docker Images:

The unused Docker images are called intermediary or dangled images. They usually don’t have any tag. Docker dangled images are not used by any containers.

You can list all the dangled or unused Docker images stored locally on your Docker host with the following command:

$ docker image list –filter dangling=true

As you can see, all the unused Docker images on my Docker host are listed.

Now, to remove all these unused Docker images, run the following command:

$ docker image prune

Now, press y and then press <Enter>.

All the unused or dangled Docker images should be removed.

As you can see, there is no more any unused or dangled Docker images on my Docker host.

Removing All Docker Images Without Container References:

You can also remove all the Docker images which don’t have at least a single container reference.

To remove all the Docker images without any container references, run the following command:

$ docker image prune -a

Now, press y and then press <Enter>.

The Docker images without any container references should be removed.

Removing All Docker Images:

If you want to remove all the Docker images from your Docker host, then this section is for you.

You can list all the locally stored Docker images on your Docker host with the following command:

$ docker image list -a

As you can see, all the locally stored images on my Docker host are listed.

Now, to remove all these Docker images, run the following command:

$ docker image rm -f $(docker image list -aq)

It may take a while to complete depending on how many images are locally stored on your Docker host. All the locally stored Docker images on your Docker host should be removed once the command finishes running.

As you can see, I don’t have any Docker image on my Docker host anymore.

So, that’s how you remove all the Docker images from your Docker host. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Docker Image vs Container

Understanding the process Docker uses to store data through images and containers will help you better design your Docker...
28/12/2020

Install Redis From Docker Hub

Overview In this post, we will see how we can install and use Redis server from  Docker Hub. Using Docker Hub is very...
28/12/2020

Understanding The Dockerfile

You’ll agree with me that the impact Docker is having on the world of technology is massive. It is saving software developers...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Huớng dẫn dùng proxy cho ios, iphone 2023
23/09/2023

Cách gắn set proxy cho điện thoại android, oppo, giả lập android, Ldplayer Bằng Proxydroid
20/09/2023

Mua Proxy Socks5 VN Chơi Game Gia Lập Tăng Cường Trải Nghiệm Chơi Game
22/06/2023

Mua Proxy Mỹ, Us Nuôi Tài Khoản Etsy, eBay Tìm Hiểu Về Mua Proxy Mỹ tại Onet.com.vn
22/06/2023

Mua Proxy Game – Giải pháp tuyệt vời cho việc chơi game trên mạng mà không bị giới hạn về vị trí địa lý
03/06/2023