I am trying to use the docker remote API from java using docker-java and I'm struggling to find a way to see when the execution of my container has finished:
CreateContainerResponse container = dockerClient.createContainerCmd("me/vw:v0.1")
.withVolumes(workingDIR)
.withBinds(new Bind("/localDrive", workingDIR))
.withCmd("vw", "/rcv1/rcv1.train.vw.gz", "--cache_file", "/rcv1/cache_train", "-f", "/rcv1/r_temp")
.withLogConfig(logconf)
.exec();
dockerClient.startContainerCmd((container.getId())).exec();
Thread.sleep(10000); //OBVIOUSLY BROKEN HACK IS BROKEN
System.out.println("PRINTING LOGS");
System.out.println(containerLog(container.getId(), dockerClient));
What is the normal way to check if container is finished? Do I have to write something that polls the docker server, or do is there some convenient blocking function/invocation? docker-java
has really bad documentation and most of what I've gotten to work is from looking at the test cases.
Cheers,
Nick