In our J2EE project, we want to call sjourdan/ffmpeg docker through the docker-java library.
A typical call for ffmpeg conversion will be something like:
docker run --rm -v /e/data:/tmp/workdir sjourdan/ffmpeg -i /tmp/workdir/test.mov -f mp4 -vcodec libx264 -acodec aac /tmp/workdir/test.mp4
We managed all of that with a DockerClient.createContainerCmd() and the right .with() methods, except for the --rm argument.
Is there a way to add it through docker-java?
According to this other StackOverflow question/answer, --rm is not handled by the Docker API, so we got no luck with docker-java either.
So, in the end we carefully remove the container after the execution, something like:
dockerClient.startContainerCmd(container.getId()).exec();
// do some stuff
dockerClient.removeContainerCmd(container.getId()).withForce(true).exec();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With