Open
Description
How to run the Exec instance after create it, I have dig throught the repo but cant find a way to make it work, here is my code below:
public String testDockerClient () {
try{
final Docker dockerClient = new UnixDocker(new File("/var/run/docker.sock"));
final Container started = dockerClient.containers().create("my-python-runner:latest");
JsonArray cmdArray = Json.createArrayBuilder()
.add("echo")
.add("helloword")
.build();
JsonObject execConfig = Json.createObjectBuilder()
.add("Cmd", cmdArray)
.add("AttachStdin", false)
.add("AttachStdout", true)
.add("AttachStderr", true)
.add("Tty", false)
.build();
started.start();
Exec output = started.exec(execConfig);
System.out.println("output: " + output.inspect());
Logs log = started.logs();
System.out.println("log: " + log.toString());
started.stop();
started.remove();
return "Success";
} catch (Exception e) {
return "Error: " + e.getMessage();
}
Metadata
Metadata
Assignees
Labels
No labels