Differences docker rm & docker rmi & docker prune the
RM Docker : Remove one or more containers
rmi Docker : Remove one or more mirrors
Prune docker : to delete the no longer used docker objects
Docker rm command
grammar
docker rm [OPTIONS] CONTAINER [CONTAINER...]
OPTIONS Description:
-
-f : by SIGKILL signal to force the removal of the container in a run
-
the -l : remove the network connection between the container rather than the container itself
-
-v : Delete the volume associated with the container
Examples
Forcibly remove container db01, db02:
docker rm -f db01 db02
Remove the container my-nginx db01 connection to the container, the connection name db01:
docker rm -l db01
Delete container my-nginx, and remove the container mounted data volumes:
docker rm -v my-nginx
Docker rmi command
grammar
docker rmi [OPTIONS] IMAGE [IMAGE...]
OPTIONS Description:
-
-f : force the removal of
-
Prune---no : without removing the mirror image process, the default removed
Examples
Forced to delete a local mirror mongo: 3.2
docker rmi -f mongo:3.2
Docker prune command
Delete all the mirrors are not labeled and non-container tag used :
docker image prune
Delete all the mirrors are not used by the container :
docker image prune -a
Delete all stop running the container :
docker container prune
Delete all non-mounted volume :
docker volume prune
Delete all of the network :
docker network prune
Delete docker all resources :
docker system prune