Skip to content

Commit

Permalink
lib: add list of output bindings to run method, #TASK-6445
Browse files Browse the repository at this point in the history
  • Loading branch information
pfurio committed Jan 28, 2025
1 parent 7a37497 commit 1966487
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,26 @@ private static List<String> getPaths(String entryPoint) {
public static String run(String image, List<AbstractMap.SimpleEntry<String, String>> inputBindings,
AbstractMap.SimpleEntry<String, String> outputBinding, String cmdParams,
Map<String, String> dockerParams) throws IOException {
return run(image, inputBindings, outputBinding != null ? Collections.singletonList(outputBinding) : null, cmdParams, dockerParams);
}

/**
* Create and run the command line to execute the docker image.
*
* @param image Docker image name
* @param inputBindings Array of bind mounts for docker input volumes (source-target)
* @param outputBindings Array of bind mount for docker output volume (source-target)
* @param cmdParams Image command parameters
* @param dockerParams Docker parameters
* @return The command line
* @throws IOException IO exception
*/
public static String run(String image, List<AbstractMap.SimpleEntry<String, String>> inputBindings,
List<AbstractMap.SimpleEntry<String, String>> outputBindings, String cmdParams,
Map<String, String> dockerParams) throws IOException {
checkDockerDaemonAlive();

String commandLine = buildCommandLine(image, inputBindings, outputBinding, cmdParams, dockerParams);
String commandLine = buildCommandLine(image, inputBindings, outputBindings, cmdParams, dockerParams);

LOGGER.info("Run docker command line");
LOGGER.info("============================");
Expand All @@ -190,6 +207,7 @@ public static String run(String image, List<AbstractMap.SimpleEntry<String, Stri
return commandLine;
}


public static void checkDockerDaemonAlive() throws IOException {
int maxAttempts = 12;
for (int i = 0; i < maxAttempts; i++) {
Expand Down

0 comments on commit 1966487

Please # to comment.