Debug School

rakesh kumar
rakesh kumar

Posted on

List out checklist of docker filter and search command

Docker provides a powerful set of filtering options when working with commands like docker ps, docker images, and other list-related commands. Here's a checklist of Docker filter commands with examples:

1. Filter by Name:
Filter containers or images by name.

docker ps --filter "name=mycontainer"
docker images --filter "reference=myimage:1.0"
Enter fullscreen mode Exit fullscreen mode

2. Filter by ID:
Filter containers or images by ID.

docker ps --filter "id=1234567890ab"
docker images --filter "id=sha256:abcdef123456"
Enter fullscreen mode Exit fullscreen mode

3. Filter by Label:
Filter containers or images by label.


docker ps --filter "label=mylabel=myvalue"
docker images --filter "label=mylabel=myvalue"
Enter fullscreen mode Exit fullscreen mode

4. Filter by Status:
Filter containers by status (running, exited, etc.).

docker ps --filter "status=running"
docker ps --filter "status=exited"
Enter fullscreen mode Exit fullscreen mode

5. Filter by Exited Containers:
Filter containers by the exit code.

docker ps -a --filter "exited=1"
Enter fullscreen mode Exit fullscreen mode

6. Filter by Publish Ports:
Filter containers by published ports.

docker ps --filter "publish=80"
Enter fullscreen mode Exit fullscreen mode

7. Filter by Network:
Filter containers by network.

docker ps --filter "network=my_network"
Enter fullscreen mode Exit fullscreen mode

8. Filter by Volume:
Filter containers by volume.

docker ps --filter "volume=my_volume"
Enter fullscreen mode Exit fullscreen mode

9. Filter by Health:
Filter containers by health status.

docker ps --filter "health=healthy"
Enter fullscreen mode Exit fullscreen mode

10. Filter by Isolation:

  • Filter containers by isolation technology (e.g., hyperv).
 docker ps --filter "isolation=hyperv"
Enter fullscreen mode Exit fullscreen mode

11. Filter by Type:

  • Filter images by type (e.g., dangling).
 docker images --filter "dangling=true"
Enter fullscreen mode Exit fullscreen mode

12. Filter by Before/After:

  • Filter containers or images created before or after a specific timestamp.
 docker ps --filter "before=timestamp"
 docker images --filter "since=timestamp"
Enter fullscreen mode Exit fullscreen mode

13. Filter by Volume Driver:

  • Filter containers by volume driver.
 docker ps --filter "volume-driver=my_volume_driver"
Enter fullscreen mode Exit fullscreen mode

14. Filter by Build:

  • Filter images by build.
 docker images --filter "label=com.docker.compose.project=myproject"
Enter fullscreen mode Exit fullscreen mode

15. Combine Multiple Filters:

  • Combine multiple filters with a comma.
 docker ps --filter "name=mycontainer" --filter "status=running"
Enter fullscreen mode Exit fullscreen mode

These filter options provide flexibility when listing or inspecting Docker containers, images, and other resources. Adjust the filters based on your specific use case and requirements.

Docker search command

The docker search command allows you to search for Docker images on Docker Hub or any other specified registry. Here's a checklist of docker search command options with examples:

1. Search for an Image:
Search for an image on Docker Hub.

docker search nginx
Enter fullscreen mode Exit fullscreen mode

2. Limit Results by Number:
Limit the number of results displayed.


docker search --limit 5 nginx
Enter fullscreen mode Exit fullscreen mode

3. Filter by Stars:
Filter images based on the number of stars.

docker search --filter "stars=3" nginx
Enter fullscreen mode Exit fullscreen mode

4. Filter by Official Images:
Filter to show only official images.

docker search --filter "is-official=true" nginx
Enter fullscreen mode Exit fullscreen mode

5. Filter by Automated Builds:
Filter to show only automated build images.

docker search --filter "is-automated=true" nginx
Enter fullscreen mode Exit fullscreen mode

6. Filter by Trusted Images:
Filter to show only trusted images.

docker search --filter "is-trusted=true" nginx
Enter fullscreen mode Exit fullscreen mode

7. Filter by Most Recently Updated:
Sort the results by most recently updated.

docker search --filter "stars=3" --filter "is-official=true" --filter "is-automated=true" --filter "is-trusted=true" --filter "stars=3" --filter "is-official=true" --filter "is-automated=true" --filter "is-trusted=true" --filter "is-trusted=true" --filter "is-trusted=true" nginx
Enter fullscreen mode Exit fullscreen mode

8. Display Only Official Images:
Display only official images.

docker search --filter "is-official=true" nginx
Enter fullscreen mode Exit fullscreen mode

9. Display Only Automated Builds:
Display only automated build images.

docker search --filter "is-automated=true" nginx
Enter fullscreen mode Exit fullscreen mode

10. Display Only Trusted Images:

  • Display only trusted images.
 docker search --filter "is-trusted=true" nginx
Enter fullscreen mode Exit fullscreen mode

11. Filter by Architecture:

  • Filter images by architecture.
 docker search --filter "architecture=amd64" nginx
Enter fullscreen mode Exit fullscreen mode

12. Filter by OS:

  • Filter images by operating system.
 docker search --filter "os=linux" nginx
Enter fullscreen mode Exit fullscreen mode

13. Filter by Type:

  • Filter images by type (e.g., plugin).
 docker search --filter "type=plugin" nginx
Enter fullscreen mode Exit fullscreen mode

14. Filter by Description:

  • Filter images by description.
 docker search --filter "description=alpine" nginx
Enter fullscreen mode Exit fullscreen mode

15. Filter by Maintainer:

  • Filter images by maintainer.
 docker search --filter "maintainer=nginx" nginx
Enter fullscreen mode Exit fullscreen mode

These options allow you to customize your search results based on various criteria, helping you find the most relevant images for your requirements. Adjust the filters based on your specific needs.

Top comments (0)