I have a server-side application running in a Docker container. One of the processes in it has hung and needs to be killed (the application will then spawn another process to replace it).
Is there any way to kill that process without stopping the Docker container?
To kill a container you use docker kill command and pass the container ID. You can pass any Unix signal when calling the kill command. When you kill a container you can start it again just like you start a container that was properly stopped.
To stop one or more running Docker containers, you can use the docker stop command. The syntax is simple: $ docker stop [OPTIONS] CONTAINER [CONTAINER...] You can specify one or more containers to stop.
To terminate a container, Docker provides the docker stop and docker kill commands. Both the docker kill and docker stop commands look similar, but their internal execution is different. The docker stop commands issue the SIGTERM signal, whereas the docker kill commands sends the SIGKILL signal.
It is not possible with Docker for now, but seems to be scheduled for 0.8, see issue #1228 here.
It is however possible to use lxc-attach to run a shell in an existing container (seen in the above issue comments) and you then can kill your hung process from there :
$ lxc-attach -n FULLCONTAINERID /bin/bash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With