Docker images are used to create containers. An image is downloaded and stored locally when a container is created using a specific Docker image. This tutorial demonstrates how to get a list of Docker images.
Get list of images
To get a list of images, use docker images command or docker image command with ls argument:
docker images
docker image ls
Output example:
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 216c552ea5ba 2 weeks ago 77.8MB
ubuntu focal 817578334b4d 2 weeks ago 72.8MB
hello-world latest feb5d9fea6a5 13 months ago 13.3kB
Get list of images by repository and tag
The docker images and docker image ls command accepts an optional argument that allows to get a list of images by repository and tag.
For example, to list all images by ubuntu repository, you can use:
docker images ubuntu
docker image ls ubuntu
Output example:
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 216c552ea5ba 2 weeks ago 77.8MB
ubuntu focal 817578334b4d 2 weeks ago 72.8MB
For example, to list all images by ubuntu repository with tag latest, you can use:
docker images ubuntu:latest
docker image ls ubuntu:latest
Output example:
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 216c552ea5ba 2 weeks ago 77.8MB
Get list of images with full length IDs
By default, image IDs are truncated. The --no-trunc option can be used to show not truncated IDs:
docker images --no-trunc
docker image ls --no-trunc
Output example:
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest sha256:216c552ea5ba7b0e3f6e33624e129981c39996021403518019d19b8843c27cbc 2 weeks ago 77.8MB
ubuntu focal sha256:817578334b4dd5e2b0654610e895e08e1bea996c58119bb9c7e3bd9e74dd8936 2 weeks ago 72.8MB
hello-world latest sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412 13 months ago 13.3kB
Leave a Comment
Cancel reply