0
0
Dockerdevops~3 mins

Listing local images in Docker - Commands & Configuration

Choose your learning style9 modes available
Introduction
Sometimes you need to see which Docker images are saved on your computer. Listing local images helps you find images you can use to create containers or clean up space.
When you want to check if an image is already downloaded before running a container
When you need to find the image ID to remove or tag an image
When you want to see all versions of an image you have locally
When you want to verify that your image build was successful and saved
When you want to clean up unused images to free disk space
Commands
This command lists all Docker images stored locally on your machine with their repository name, tag, image ID, creation date, and size.
Terminal
docker images
Expected OutputExpected
REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 4bb46517cac3 2 weeks ago 133MB ubuntu 20.04 1d622ef86b13 3 weeks ago 72.9MB
-a - Show all images (default shows just latest tags)
--digests - Show image digests
This is an alternative command to list local images. It works the same as 'docker images' and is part of the newer Docker CLI syntax.
Terminal
docker image ls
Expected OutputExpected
REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 4bb46517cac3 2 weeks ago 133MB ubuntu 20.04 1d622ef86b13 3 weeks ago 72.9MB
Key Concept

If you remember nothing else from this pattern, remember: use 'docker images' or 'docker image ls' to see all Docker images saved on your computer.

Common Mistakes
Typing 'docker image' without 'ls' or 'images'
The command is incomplete and will show an error because it expects a subcommand like 'ls' or 'rm'.
Use 'docker image ls' or 'docker images' to list images.
Expecting 'docker images' to show running containers
'docker images' only lists images, not containers. Containers are different and require 'docker ps'.
Use 'docker ps' to list running containers.
Summary
Use 'docker images' or 'docker image ls' to list all local Docker images.
The output shows repository, tag, image ID, creation time, and size.
Flags like '-a' show all images including intermediate ones.