In this article, I will show you how to list all the locally stored Docker images on 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.
- How to Install and Use Docker on Ubuntu 18.04 LTS (https://linuxhint.com/install_docker_ubuntu_1804/)
- Install Docker on Debian 9 (https://linuxhint.com/install_docker_debian_9/)
- Install Docker on CentOS 7 (https://linuxhint.com/install-docker-centos7/)
- Install Docker on Raspberry Pi (https://linuxhint.com/install_docker_raspberry_pi/)
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.
Listing Locally Stored Docker Images:
To list all the locally stored Docker images, you can run the following command:
As you can see, all the locally stored Docker images are listed. You can see the repository name, tag, short image ID, date of creation and size of the locally stored Docker images.
The short image ID is enough to distinguish between the Docker images uniquely. But if you prefer the long image ID, you can use the –no-trunc option with the previous command.
To list the locally stored Docker images along with the long image ID, run the following command:
As you can see, the long sha256 format of the image ID is displayed.
Listing Docker Intermediary or Bad Images:
Docker intermediary images has the repository and tag name <none>:<none>. These are basically unused Docker images. They don’t have any importance. You should remove them occasionally.
To list all the unused Docker images on your Docker host, run the following command:
As you can see, all the unused Docker images along with their image ID, creation date, size are listed.
Listing Only Docker Image IDs:
At times, you may only need a list of image IDs of the locally stored Docker images on your Docker host. This is very important for scripting purpose and for removing Docker images.
To list only the image IDs of the unused Docker images on your Docker host, run the following command:
As you can see, only the image ID of the unused Docker images are listed.
To list all the image IDs of the good Docker images, run the following command:
As you can see, only the image ID of the good Docker images are listed.
So, that’s how you list locally stored Docker images on your Docker host. Thanks for reading this article.