Forrest logo
back to the docker tool

docker:tldr:89906

docker: Kill one or more running containers.
$ docker container kill ${container_name}
try on your machine

The command "docker container kill ${container_name}" is used to stop and kill a running container in Docker.

Here's how it works:

  • "docker container kill" is the base command used for killing a Docker container.
  • "${container_name}" is a placeholder that should be replaced with the actual name or ID of the container you want to kill. The dollar sign and curly braces are used for variable expansion, which allows you to pass the container name as an argument to the command.

When you execute this command, Docker will send a kill signal to the specified container, which will immediately terminate its processes and stop the container. This is similar to forcefully shutting down a running application or process.

It's important to note that the container will be completely stopped and destroyed when you run this command. If you want to gracefully stop a container and have a chance to clean up or save any data, you can use the "docker container stop" command instead.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool