Skip to content

Commit

Permalink
Do not fail on duplicated local image tags. Fixes testcontainers#2431 (
Browse files Browse the repository at this point in the history
…testcontainers#2692)

* testcontainers#2431 Correction for an edge case in local image repos (duplicates repo tags) crashing the image pulling

* Indentation correction

* Indentation correction
  • Loading branch information
Choobz authored and quincy committed May 28, 2020
1 parent c4f00bf commit ce4851e
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@ private void populateFromList(List<Image> images) {
}

cache.putAll(
Stream.of(repoTags).collect(Collectors.toMap(
DockerImageName::new,
it -> ImageData.from(image)
))
Stream.of(repoTags)
// Protection against some edge case where local image repository tags end up with duplicates
// making toMap crash at merge time.
.distinct()
.collect(Collectors.toMap(
DockerImageName::new,
it -> ImageData.from(image)
))
);
}
}
Expand Down

0 comments on commit ce4851e

Please sign in to comment.