“docker images” Command Examples

The “docker images” command is a part of the Docker CLI and is used to manage Docker images. Docker images are the building blocks of containers and contain all the necessary files, dependencies, and configurations required to run an application.

The “docker images” command provides a list of Docker images available on the local system. It displays information about the images, including their repository, tag, image ID, creation date, and size. This command gives users an overview of the Docker images they have downloaded or built on their machine.

By executing the “docker images” command without any additional options or arguments, a table is displayed containing all the Docker images available locally. Each row in the table represents a Docker image and provides information about its repository (or image name), tag, image ID, and size. This information helps users identify and manage their Docker images effectively.

The “docker images” command also supports several options that allow users to customize the output or filter the list of images based on specific criteria. For example, the “–all” or “-a” option shows all images, including intermediate image layers, rather than just the top-level images. The “–filter” option can be used to display images that match specific criteria, such as images with a particular label or those created before or after a certain date.

In addition to displaying information about Docker images, the “docker images” command also provides users with the ability to remove unwanted or unused images. By using the “docker image rm” command followed by the image ID or repository name, users can delete one or more Docker images from their local system. This helps to free up disk space and manage the image repository more efficiently.

docker images Command Examples

1. List all Docker images:

# docker images

2. List all Docker images including intermediates:

# docker images --all

3. List the output in quiet mode (only numeric IDs):

# docker images --quiet

4. List all Docker images not used by any container:

# docker images --filter dangling=true

5. List images that contain a substring in their name:

# docker images "*name*"

Summary

Overall, the “docker images” command is a fundamental tool for managing Docker images. It provides an overview of the images available on the local system and allows users to remove unnecessary images. With this command, users can keep their Docker image repository organized, optimize disk usage, and ensure smooth operations when building and running containers.

Related Post