0

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 ? :-)

codenewbie
  • 61
  • 7

1 Answers1

2

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();
David Maze
  • 130,717
  • 29
  • 175
  • 215