🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
In this quick guide, we will see how to display a list of all the Docker images on your system.
Check out all Docker tutorials and guides: Docker Tutorials and Guides
The docker images Command
The primary command to list Docker images is:
docker images [OPTIONS] [REPOSITORY[:TAG]]Running docker images without any arguments will display a list of all the images on your system.
The information provided includes:
REPOSITORY: Name of the image.
TAG: Version or variant of the image.
IMAGE ID: A unique identifier for each image.
CREATED: Age of the image.
SIZE: Disk space the image occupies.
Practical Examples
Listing All Docker Images:
Run the following command to display a list of all the images on your system:
docker imagesOrdocker image lsFiltering by Image Name:
To list images from a specific repository, specify its name:
docker images nginxOnly Showing Image IDs:
This is useful if you're scripting or need to quickly grab IDs for removal:
docker images -qFilter Images by Creation Time:
To view images created since a specific image:
docker images -f "since=nginx:latest"Why would you want to list Docker images?
Cleanup: Over time, as you work with Docker, you may accumulate a large number of unused or unnecessary images. By listing them, you can identify which ones to remove.
Verification: After pulling a new image or building an image from a Dockerfile, it's a good practice to list images to verify that the operation succeeded.
Management: Especially in environments where multiple applications or services are containerized, keeping track of available images helps in managing deployments and updates.
Remember, the docker images command only shows images on your local system. If you're using a remote Docker repository or a service like Docker Hub, you'd need other mechanisms or commands to list images stored there.
Comments
Post a Comment
Leave Comment