File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
main/java/com/github/dockerjava/netty/exec
test/java/com/github/dockerjava/netty/exec Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ protected List<Image> execute(ListImagesCmd command) {
3333 webTarget = webTarget .queryParam ("filters" , urlPathSegmentEscaper ().escape (FiltersEncoder .jsonEncode (command .getFilters ())));
3434 }
3535
36+ if (command .getImageNameFilter () != null ) {
37+ webTarget = webTarget .queryParam ("filter" , urlPathSegmentEscaper ().escape (command .getImageNameFilter ()));
38+ }
39+
3640 LOGGER .trace ("GET: {}" , webTarget );
3741
3842 List <Image > images = webTarget .request ().accept (MediaType .APPLICATION_JSON )
Original file line number Diff line number Diff line change @@ -75,6 +75,18 @@ public void listImagesWithDanglingFilter() throws DockerException {
7575 assertTrue (imageInFilteredList );
7676 }
7777
78+ @ Test
79+ public void listImagesWithNameFilter () throws DockerException {
80+ String imageId = createDanglingImage ();
81+ dockerClient .tagImageCmd (imageId , "test_repository" , "latest" ).exec ();
82+ List <Image > images = dockerClient .listImagesCmd ().withImageNameFilter ("test_repository:latest" ).exec ();
83+ assertThat (images , notNullValue ());
84+ LOG .info ("Images List: {}" , images );
85+ assertThat (images .size (), is (equalTo (1 )));
86+ Boolean imageInFilteredList = isImageInFilteredList (images , imageId );
87+ assertTrue (imageInFilteredList );
88+ }
89+
7890 private boolean isImageInFilteredList (List <Image > images , String expectedImageId ) {
7991 for (Image image : images ) {
8092 if (expectedImageId .equals (image .getId ())) {
You can’t perform that action at this time.
0 commit comments