i'm using the java-docker client from here: https://github.com/docker-java/docker-java. I trying to figure out how to set the stop timeout for the docker stop command.
So i'm using in java the method dockerClient.stopContainerCmd(containerId)).exec(); but there is no option for the stop timeout, like the docker cli provides. Maybe someone has already solved the problem or has an idea ? :-)
1 Answer 1
dockerClient.stopContainerCmd() returns a StopContainerCmd object, and that has a .withTimeout() method. You should be able to add this into your call chain:
dockerClient
.stopContainerCmd(containerId)
.withTimeout(new Integer(60)) // appears to be seconds
.exec();
answered Dec 7, 2021 at 11:57
David Maze
165k47 gold badges263 silver badges305 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
codenewbie
nice i didn't see this, i'll check this out