O'Reilly logo

Docker and Kubernetes for Java Developers by Jaroslaw Krochmalski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Stopping

To stop one or more running Docker containers we use the docker stop command. The syntax is simple:

$ docker stop [OPTIONS] CONTAINER [CONTAINER...]  

You can specify one or more container to stop. The only option for docker stop is -t (--time) which allows us to specify a time to wait before stopping a container. 10 seconds is the default value, which is supposed to be enough for the container to gracefully stop. To stop the container in a more brutal way, you can execute the following command:

$ docker kill  CONTAINER [CONTAINER...]  

What's the difference between docker stop and docker kill ? They will both stop a running container. There's an important difference though:

  • docker stop: The main process inside the container will first ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required