Search Docker Images with docker search Command
To run docker containers we need images, To find images we can use the docker search command. The docker search command help us search images from the docker public repository. In this docker tutorial we are going to learn how to search docker images using the docker search command.
The docker search command, search images that match the specified TERM.
docker search TERM
For example, Following command will search for the WordPress images.
docker search wordpress
As above screenshot shows, search results include image name, Description and number of stars awarded for the image. Is is also tells us whether the image is official, and whether it is automated.
Official images are the images that officially created by the project that bears its name. In this case WordPress official image is provided by the WordPress development team.
Following Query will only return official docker images.
docker search --filter=is-official=true wordpress
By default, search queries will only return up to 25 results, But we can control the limit using the '--limit' option.
docker search --limit=50 wordpress
The above search query will return up to 50 results.
Also the image description is truncated by default. To get a full image description '---no-trunc' option need to use.
docker search --no-trunc wordpress
After searching the image, we can pull it to the local system by running the docker pull command:
docker pull wordpress
Docker Search Examples
For the Docker search help, Type:
docker search --help
Search for the Term 'ubuntu':
docker search ubuntu
Search for the Ubuntu Image, But only display official images:
docker search --filter=is-official=true ubuntu
Search the Term 'Nginx' and only display the images ranked 5 or higher:
docker search --filter=stars=5 nginx
Search Docker Hub for the term 'mysql' and only display automated images ranked 5 or higher:
docker search --filter=stars=5 --filter=is-automated=true mysql
Search command is very simple and easy to use, But not necessarily the best way to find docker images. Instead, you should search on the docker hub webpage to get more detail information about the image you want to download.