Hi,
I am looking for filtering support based on name, id in the docker-java version 3.0.6. I am not able to find any test example in the github which describes filtering by id / name on a list of containers.
May I know is there a filtering support for id, name enabled in the version 3.0.6. If yes, can somebody share a code snippet of how to enable filtering based on id / name?
Any quick response will be helpful.
Thanks,
Krishnaprasad
I use this method to get container by name:
Optional<Container> containerItem = dockerClient.listContainersCmd().withShowAll(true).exec()
.stream()
.filter(container -> container.getNames()[0].equals(String.format("/%s", name)))
.findFirst();
You can modify filter method to use .contains(...) and collect to list instead
Thanks Mark for your response. I will give it a try
I tried the code which you mentioned. That works :+1:
Thanks Mark.
Any reason filtering by container name isn't pushed down into the list container command call to Docker Daemon?