github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/reference/commandline/rm.md (about) 1 <!--[metadata]> 2 +++ 3 title = "rm" 4 description = "The rm command description and usage" 5 keywords = ["remove, Docker, container"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # rm 12 13 ```markdown 14 Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...] 15 16 Remove one or more containers 17 18 Options: 19 -f, --force Force the removal of a running container (uses SIGKILL) 20 --help Print usage 21 -l, --link Remove the specified link 22 -v, --volumes Remove the volumes associated with the container 23 ``` 24 25 ## Examples 26 27 $ docker rm /redis 28 /redis 29 30 This will remove the container referenced under the link 31 `/redis`. 32 33 $ docker rm --link /webapp/redis 34 /webapp/redis 35 36 This will remove the underlying link between `/webapp` and the `/redis` 37 containers removing all network communication. 38 39 $ docker rm --force redis 40 redis 41 42 The main process inside the container referenced under the link `/redis` will receive 43 `SIGKILL`, then the container will be removed. 44 45 $ docker rm $(docker ps -a -q) 46 47 This command will delete all stopped containers. The command 48 `docker ps -a -q` will return all existing container IDs and pass them to 49 the `rm` command which will delete them. Any running containers will not be 50 deleted. 51 52 $ docker rm -v redis 53 redis 54 55 This command will remove the container and any volumes associated with it. 56 Note that if a volume was specified with a name, it will not be removed. 57 58 $ docker create -v awesome:/foo -v /bar --name hello redis 59 hello 60 $ docker rm -v hello 61 62 In this example, the volume for `/foo` will remain intact, but the volume for 63 `/bar` will be removed. The same behavior holds for volumes inherited with 64 `--volumes-from`.