With 20.10.0 docker removed the filter parameter when listing images.
https://docs.docker.com/engine/deprecated/#filter-param-for-imagesjson-endpoint
This causes
return dockerClient.listImagesCmd()
.withImageNameFilter("mongo:4.2")
.exec()
.stream()
.findFirst()
.map(Image::getId);
to return the ID of the first image out of ALL images.
My current workaround for this is
try{
return Optional.ofNullable(dockerClient.inspectImageCmd("mongo:4.2").exec().getId());
} catch (final NotFoundException e) {
return Optional.empty();
}
Yes, that's correct (they removed the deprecated param)
There are several options:
Great! Wasn't aware that 3.2.7 is already available.
I couldn't find it on Maven central.
I assume it will be published within the next days?
Thank you for providing the 3rd method. I wasn't aware of this.
(edit) Just noticed that the release happened during the investigation of the issue I had.
https://github.com/docker-java/docker-java/releases/tag/3.2.7
Happy to help!
The release is on jcenter amd will be synced to Maven Central soon (later today)
@bsideup Given the original issue example, how would it look like in 3 cases you have suggested, sorry?
@bsideup Given the original issue example, how would it look like in 3 cases you have suggested, sorry?
ListImagesCmd listImagesCmd = dockerClient.listImagesCmd();
listImagesCmd.getFilters().put("reference", Arrays.asList("my/image"));
List<Image> images = listImagesCmd.exec();