

You can also include more than one status as follows :ĭocker rm $(docker ps -a -filter status=your_status1 -filter status=your_status2 -q) Removing a container immediately after you are done with it Now to delete those specific containers, issue the command below :ĭocker rm $(docker ps –filter status=your_status -q) Where your_status can be one of the following : created, running, restarting, removing, exited, paused and dead. To first find the list of containers with a specific status, you can use the -filter option of the ‘docker ps’ command in order to filter out those with the required status as follows : This can also work with the names of the containers as well… Removing all containers with a given status Now to remove these containers, issue the command below (docker rm all containers IDs):ĭocker rm ID1 ID2 To remove one or several containers, you would first need to obtain their IDs (or names) using the command
Docker for mac disk image size how to#
Read: How to install and setup Docker on Linux/Ubuntu 18.04 Removing Containers On these versions, you can run : docker container prune docker network prune and docker image prune separately in order to delete unused containers, networks and images without suppressing volumes. In older versions, volumes are pruned by default. Note: The –volumes flag was introduced in Docker 17.06.1. To additionally prune volumes as well, you can use the –volumes option as follows :

This is to prevent important data from being removed if no container is currently using the volume. Which will also remove all stopped containers and all build cache. Removing unused Docker objectsĭocker offers a command that will remove all unused containers, images (unreferenced and dangling), networks and (optionally) volumes. In this article we will go through some commands which help achieve this clean-up procedure.
Docker for mac disk image size free#
If these are no longer used or needed they may consume additional disk space.įortunately Docker has a garbage collection mechanism that help remove unused containers, images and data volumes so that it can free up disk space and tidy up your system. If you have been working with Docker for some time, it is likely that you may have accumulated a high number of images, data volumes as well as containers.
