Container images are generally stored in image registries. Distribute through public or private users. Image registries share container images to download. You can configure registries for docker search.
In this topic, I am going to check the docker search command, which finds images in different image registries and filters through image name, user name, or according and the rating stars.
The syntax for the docker search command is shown below:
# docker search [OPTIONS] TERM
docker search will search in docker hub or container registries, which you configured in the registries configuration file.
Below docker search commands will use some useful for the search subcommand:
1 . Search by container name:
Below commands will search images with a name containing ‘Nginx’ . I am showing examples with Nginx container name. You can modify it according to you.
# docker search nginx
2 . Limit Search
This option will search or list images per registry. For example, if we have a number of registries available then a limited number of images will show per registry. –limit option will show results according to the given limit per registry.
# docker search --limit=<number> container_name
The below result shows the docker command search Nginx container in a different registry. Eg: the fedora project, docker.io, etc. It is limited to two projects.
3. –filter option –filter <filter=value>
this will filter output based on sub-option command filters :
a . –filter stars
This will filter container registery according to stars which has.
# docker search --filter stars=4 nginx
b. –filter is-official
This condition will show only those images that are official images.
# docker search --filter is-official=true nginx
c. –filter is-automated=true/false
This conditional option will show only images, which will be built automatically.
# docker search --filter is-automated=true nginx