The difference between kill and rm in docker: 1. The kill command in docker will directly send the SIGKILL signal to kill the container, while the rm command will delete one or more containers; 2. The rm command will delete the generated files generated during the running of the container. data, and the kill command will not delete the data generated when the container is running.
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
What is the difference between kill and rm in docker
docker rm: delete one or more containers.
Syntax
docker rm [OPTIONS] CONTAINER [CONTAINER...]
OPTIONS Description:
-f: Forcefully delete a running container through the SIGKILL signal.
-l : Removes network connections between containers, not the containers themselves.
-v : Delete the volume associated with the container.
Example
Force deletion of containers db01 and db02:
docker rm -f db01 db02
Remove the connection of container nginx01 to container db01, connection name db:
docker rm -l db
docker kill: Kill a running container.
Syntax
docker kill [OPTIONS] CONTAINER [CONTAINER...]
OPTIONS Description:
-s: Send a signal to the container
Example
Kill the running container mynginx
runoob@runoob:~$ docker kill -s KILL mynginx mynginx
Docker rm will delete the data generated during the running of the container, but docker kill will not.
Recommended learning: "docker video tutorial"
The above is the detailed content of What is the difference between kill and rm in docker. For more information, please follow other related articles on the PHP Chinese website!