This article will explain the method to filter Docker images by pattern using wildcards.
How to Filter Docker Images by Pattern Using Wildcards?
Wildcards are special characters that can be utilized to match any other character or sequence of characters in a string. To filter Docker images by pattern with wildcards, first, view all the Docker images. Then, utilize the “docker images “<wildcard-pattern>”” command. The, “<wildcard-pattern>” can be a partial or full image name or tag, and a wildcard character “*” is used to match any characters before or after the pattern.
Step 1: List All Docker Images
First, display all the available Docker images via the below-listed command:
In the above output, all the Docker images can be seen.
Step 2: Filter Docker Images
To filter images and list only those whose name starts with “img”, utilize the “docker images “img*”” command:
The above output has returned the list of the images whose names are starting with “img”.
To display images that end with the word “img”, use “*” before the keyword:
This command has displayed one image which is ending with the “img” word.
Moreover, use the “*” symbol at the start and end of the keyword to list all the images that contain the particular keyword in them:
The above screenshot shows the list of all Docker images whose names contain the word “img”.
To filter a particular image along with the tag, write out the provided command:
This command displays the image containing the word “img” and has a “V1.0” tag.
Conclusion
To filter the Docker images by the pattern with wildcards, the “docker images “<wildcard-pattern>”” command is used. The, “<wildcard-pattern>” can be a partial or full image name or tag, and a wildcard character “*” is used to match any characters before or after the pattern. This article has explained the method to filter Docker images by pattern using wildcards.