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

asked Dec 7, 2021 at 7:32

1 Answer 1

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();
answered Dec 7, 2021 at 11:57
Sign up to request clarification or add additional context in comments.

1 Comment

nice i didn't see this, i'll check this out

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.