github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/reference/commandline/rm.md (about) 1 --- 2 title: "rm" 3 description: "The rm command description and usage" 4 keywords: "remove, Docker, container" 5 --- 6 7 <!-- This file is maintained within the docker/docker Github 8 repository at https://github.com/docker/docker/. Make all 9 pull requests against that repo. If you see this file in 10 another repository, consider it read-only there, as it will 11 periodically be overwritten by the definitive file. Pull 12 requests which include edits to this file in other repositories 13 will be rejected. 14 --> 15 16 # rm 17 18 ```markdown 19 Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...] 20 21 Remove one or more containers 22 23 Options: 24 -f, --force Force the removal of a running container (uses SIGKILL) 25 --help Print usage 26 -l, --link Remove the specified link 27 -v, --volumes Remove the volumes associated with the container 28 ``` 29 30 ## Examples 31 32 $ docker rm /redis 33 /redis 34 35 This will remove the container referenced under the link 36 `/redis`. 37 38 $ docker rm --link /webapp/redis 39 /webapp/redis 40 41 This will remove the underlying link between `/webapp` and the `/redis` 42 containers removing all network communication. 43 44 $ docker rm --force redis 45 redis 46 47 The main process inside the container referenced under the link `/redis` will receive 48 `SIGKILL`, then the container will be removed. 49 50 $ docker rm $(docker ps -a -q) 51 52 This command will delete all stopped containers. The command 53 `docker ps -a -q` will return all existing container IDs and pass them to 54 the `rm` command which will delete them. Any running containers will not be 55 deleted. 56 57 $ docker rm -v redis 58 redis 59 60 This command will remove the container and any volumes associated with it. 61 Note that if a volume was specified with a name, it will not be removed. 62 63 $ docker create -v awesome:/foo -v /bar --name hello redis 64 hello 65 $ docker rm -v hello 66 67 In this example, the volume for `/foo` will remain intact, but the volume for 68 `/bar` will be removed. The same behavior holds for volumes inherited with 69 `--volumes-from`.