From 5babc47b2c63789b74447f2fdabb09f316a96f6b Mon Sep 17 00:00:00 2001 From: Amit Poonia Date: Sun, 10 Mar 2019 20:59:13 +0530 Subject: [PATCH] Added command to removed unused data (#30665) Added docker system prune command, which removes all unused data. --- .../containers/docker/useful-commands-for-docker/index.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/guide/english/containers/docker/useful-commands-for-docker/index.md b/guide/english/containers/docker/useful-commands-for-docker/index.md index 5d87f4014d..33682c01fc 100644 --- a/guide/english/containers/docker/useful-commands-for-docker/index.md +++ b/guide/english/containers/docker/useful-commands-for-docker/index.md @@ -87,6 +87,11 @@ $ docker stop $(docker ps -q) ### Remove containers while running (forcefully) `$ docker rm -f $(docker ps -a -q)` +### Remove all unused data +`$ docker system prune -a` + - This command will remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes. + - Note that in older Docker versions (below Docker 17.06.1) this command will also remove all those volumes which are not being used by any container. In newer Docker versions use the command `$ docker system prune -a --volumes` to remove unused volumes as well. + ### Giving docker OS a name when starting - By default, docker gives unique name to every container with a unique id. - We can also give a name to container using following command - @@ -128,4 +133,4 @@ Let the partition created is **mypart** This command will attach a RHEL to the container. ### Copy content from a folder of base system to _/data_ in docker centos -`$ docker run –it -v /folder_name:/data centos` \ No newline at end of file +`$ docker run –it -v /folder_name:/data centos`