From 9a20a1f95e09c55b57ebaf9a06cdb5a59d0b01ac Mon Sep 17 00:00:00 2001 From: Prashant Patel Date: Sat, 11 Sep 2021 15:18:07 +0530 Subject: [PATCH] Fixing the docker images filter issue with ListImagesParam.byName which actually picking the first available image in repository. Using java filter to filter the docker images by name. --- .../zalando/ep/zalenium/container/DockerContainerClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/zalando/ep/zalenium/container/DockerContainerClient.java b/src/main/java/de/zalando/ep/zalenium/container/DockerContainerClient.java index 5b4c705d1a..2c60c5277a 100644 --- a/src/main/java/de/zalando/ep/zalenium/container/DockerContainerClient.java +++ b/src/main/java/de/zalando/ep/zalenium/container/DockerContainerClient.java @@ -263,7 +263,9 @@ public void executeCommand(String containerId, String[] command, boolean waitFor public String getLatestDownloadedImage(String imageName) { List images; try { - images = dockerClient.listImages(DockerClient.ListImagesParam.byName(imageName)); + images = dockerClient.listImages(DockerClient.ListImagesParam.allImages()) + .stream().filter(image -> image.repoTags().stream().anyMatch(i -> i.contains(imageName))) + .collect(Collectors.toList()); if (images.isEmpty()) { logger.error(nodeId + " A downloaded docker-selenium image was not found!"); return imageName;