@@ -79,12 +79,21 @@ public static ContainerRuntimeVersionTestUtils fromVersionString(String version)
7979 try {
8080 // Example 'docker version 20.10.0 or podman version 4.9.4-rhel'
8181 String versNums = version .split ("\\ s+" , 3 )[2 ];
82+ // On some docker implementations e.g. RHEL8 ppc64le we have the following version output:
83+ // Docker version v25.0.3, build 4debf41
84+ // Trim potentially leading 'v' and trailing ','
85+ if (versNums .startsWith ("v" )) {
86+ versNums = versNums .substring (1 );
87+ }
88+ int cidx = versNums .indexOf (',' );
89+ versNums = (cidx != -1 ) ? versNums .substring (0 , cidx ) : versNums ;
90+
8291 String [] numbers = versNums .split ("-" )[0 ].split ("\\ ." , 3 );
8392 return new ContainerRuntimeVersionTestUtils (Integer .parseInt (numbers [0 ]),
8493 Integer .parseInt (numbers [1 ]),
8594 Integer .parseInt (numbers [2 ]));
8695 } catch (Exception e ) {
87- throw new RuntimeException ("Failed to parse container runtime version: " + version );
96+ throw new RuntimeException ("Failed to parse container runtime version: " + version , e );
8897 }
8998 }
9099
@@ -104,4 +113,4 @@ public static String getContainerRuntimeVersionStr() {
104113 public static ContainerRuntimeVersionTestUtils getContainerRuntimeVersion () {
105114 return ContainerRuntimeVersionTestUtils .fromVersionString (getContainerRuntimeVersionStr ());
106115 }
107- }
116+ }
0 commit comments