The Docker images command
docker images This command lists the local Docker images.
Pass docker images With this command, users can view detailed information about all downloaded or built Docker images, such as repository name, tag, image ID, creation time, and size.
Syntax
docker images [OPTIONS] [REPOSITORY[:TAG]]
OPTIONS description:
-a, --all: Show all images (including intermediate layer images).--digests: Show image digest information.-f, --filter: Filter the output based on the given conditions.--format: Format the output using a Go template.--no-trunc: Show the full image ID.-q, --quiet: Show only image IDs.
List all local images:
docker images
List images with digest information:
docker images --digests
List all images (including intermediate layer images):
docker images --all
List images using filter conditions:
docker images --filter "dangling=true"
Show only image IDs:
docker images --quiet
Output using a custom format:
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.Size}}"
Example
View the local image list:
runoob@runoob:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mymysql v1 37af1236adef 5 minutes ago 329 MB
runoob/ubuntu v4 1c06aa18edee 2 days ago 142.1 MB
5c6e1090e771 2 days ago 165.9 MB
httpd latest ed38aaffef30 11 days ago 195.1 MB
alpine latest 4e38e38c8ce0 2 weeks ago 4.799 MB
mongo 3.2 282fd552add6 3 weeks ago 336.1 MB
redis latest 4465e4bcad80 3 weeks ago 185.7 MB
php 5.6-fpm 025041cd3aa5 3 weeks ago 456.3 MB
python 3.5 045767ddf24a 3 weeks ago 684.1 MB
...
List local images whose REPOSITORY is ubuntu:
root@runoob:~# docker images ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 14.04 90d5884b1ee0 9 weeks ago 188 MB
ubuntu 15.10 4e3b13c8a266 3 months ago 136.3 MB
Output with digest information:
docker images --digests
Output:
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
ubuntu latest sha256:8c53f09a9c6f1e85e10a8ffb649dd9de28b9be4994e792bd96fca152527bba03 2d13d07a40a3 2 weeks ago 72.9MB
nginx stable sha256:1c4f40db5d1c8e5e09d28e501ad167d7c2d91b8908f6f1d9c97d1c67c5f9a69b 5a34e9e5d33b 3 weeks ago 133MB
hello-world latest sha256:feda4427b0b5d9d84545dcb38e736a5226e5bb6228c61b0b6b28cb7483a14b68 feb5d9fea6a5 4 weeks ago 13.3kB
Output using filter conditions:
docker images --filter "dangling=true"
Example output:
REPOSITORY TAG IMAGE ID CREATED SIZE
7db03500db4f 5 weeks ago 65.3MB
Custom format output:
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.Size}}"
Output:
REPOSITORY TAG IMAGE ID SIZE
ubuntu latest 2d13d07a40a3 72.9MB
nginx stable 5a34e9e5d33b 133MB
hello-world latest feb5d9fea6a5 13.3kB
Common Scenarios
- Manage images: List local images to understand which images are currently available.
- Filter images: Use filter options to find images matching specific conditions, such as dangling images (untagged images).
- Image ID management: Obtain only image IDs for subsequent operations, such as deleting images.
docker images This command is a very basic and important command in Docker image management. Through it, users can view detailed information about all local images and manage and maintain images. Using various options and formats, you can flexibly filter and format the output to meet different management needs.
Docker Command Reference