How to List Docker Images: Simple Commands Explained
Use the
docker images command to list all Docker images on your system. This command shows image IDs, tags, creation dates, and sizes in a table format.Syntax
The basic command to list Docker images is docker images. You can add options like -a to show all images including intermediate layers, or --filter to narrow down results.
docker images: Lists all top-level images.docker images -a: Lists all images including intermediate layers.docker images --filter "dangling=true": Lists images not tagged and not referenced by any container.
bash
docker images [OPTIONS] # Common options: # -a, --all Show all images (default hides intermediate images) # --filter filter Filter output based on conditions provided
Example
This example shows how to list all Docker images on your system using the basic command. It displays columns like REPOSITORY, TAG, IMAGE ID, CREATED, and SIZE.
bash
docker images
Output
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 2ca708c1c9cc 2 weeks ago 73.9MB
nginx stable 4bb46517cac3 3 weeks ago 133MB
myapp v1.0 7d9495d03763 5 days ago 256MB
Common Pitfalls
One common mistake is expecting docker images to show running containers instead of images. To see running containers, use docker ps.
Another pitfall is not using -a when you want to see all images including intermediate layers, which can be important for debugging.
bash
docker ps # Wrong command to list images docker images -a # Correct command to list all images including intermediate
Quick Reference
| Command | Description |
|---|---|
| docker images | List all top-level Docker images |
| docker images -a | List all images including intermediate layers |
| docker images --filter "dangling=true" | List untagged images not used by any container |
| docker images --format "{{.Repository}}: {{.Tag}}" | Custom output format showing repository and tag |
Key Takeaways
Use
docker images to see all your Docker images in a table format.Add
-a to include intermediate images in the list.Use
docker ps to list running containers, not images.Filters help narrow down images, like showing only dangling images.
The output shows repository, tag, image ID, creation time, and size.