From c44a075f781cf52dc10b668b2bde2c5f4603ed90 Mon Sep 17 00:00:00 2001 From: Roei Date: Tue, 8 Oct 2019 11:18:25 +0300 Subject: [PATCH 1/2] add some clean up commends --- docker.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docker.md b/docker.md index 3d173da6b..73946ce9f 100644 --- a/docker.md +++ b/docker.md @@ -123,6 +123,46 @@ docker rmi b750fe78269d Deletes `image`s. +Clean up +------ + +### `clean All` +```sh +docker system prune +``` +will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container) + +```sh +docker system prune -a +``` +additionally remove any stopped containers and all unused images (not just dangling images) + +### `docker containers` + +```sh +docker stop $(docker ps -a -q) +``` + +stop all the running containers. + +```sh +docker rm $(docker ps -a -q) +``` + +delete all the containers + +### `Images` +```sh +docker rmi $(docker images -a -q) +``` +delte all the images + +### `Volumes` +```sh +docker volume prune +``` +delete all the volumes + Also see -------- From 8820f58f310ada4e8cac0265ef7fd745e54f1097 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Tue, 15 Oct 2019 20:27:06 +1100 Subject: [PATCH 2/2] Update docker.md --- docker.md | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/docker.md b/docker.md index 73946ce9f..bc074c7fe 100644 --- a/docker.md +++ b/docker.md @@ -123,45 +123,47 @@ docker rmi b750fe78269d Deletes `image`s. -Clean up ------- +## Clean up + +### Clean all -### `clean All` ```sh docker system prune ``` -will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container) + +Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container) ```sh docker system prune -a ``` -additionally remove any stopped containers and all unused images (not just dangling images) -### `docker containers` +Additionally remove any stopped containers and all unused images (not just dangling images) + +### Containers ```sh +# Stop all running containers docker stop $(docker ps -a -q) + +# Delete stopped containers +docker container prune ``` -stop all the running containers. +### Images ```sh -docker rm $(docker ps -a -q) +docker image prune [-a] ``` -delete all the containers +Delete all the images -### `Images` -```sh -docker rmi $(docker images -a -q) -``` -delte all the images +### Volumes -### `Volumes` ```sh docker volume prune ``` -delete all the volumes + +Delete all the volumes Also see --------