In our J2EE project, we're doing some video conversion by calling sjourdan/ffmpeg docker from our java code, relying on docker-java.
For now, it looks something like this (quite simplified for brevity):
CreateContainerCmd createCommand = dockerClient.createContainerCmd("sjourdan/ffmpeg")
.withVolumes(aVolume)
.withBinds(aBind)
.withCmd("a lot of options about the conversion itself, codec, ratio, …");
CreateContainerResponse container = createCommand.exec();
dockerClient.startContainerCmd(container.getId()).exec();
// vanilla implementation of ResultCallback
MyResultCallback callback = new MyResultCallback();
dockerClient.waitContainerCmd(container.getId()).exec(callback);
Fact is, of course, the thread keeps going after that without waiting the callback to be called back.
How should we do to force the thread to wait until the callback is called, informing us the docker command is fully ended?
On another note, if someone knows how to add a --rm
parameter to the played docker run
command using docker-java, I'm interested.