This article will discuss methods to recover disk space from docker. Sometimes systems get piled up by docker images and we might get a low disk space warning.
Run the following steps to recover disk space from docker :
1. Remove unused docker data
Unused docker containers, networks, images, and volumes takes disk space. To remove the unused docker data run the following command :
docker system prune
2. Remove unused images
Unused docker images can take up disk space. We can reclaim some disk space by removing unused docker images. To remove unused images run the following command :
docker image prune
3. Remove specific docker image
We can list all the docker images by using the following command:
If we want to remove a specific docker container run the following command :
docker rmi <image id>
Here the image id is the id of the docker container. To get “image id”, run “docker images” command, and from its output we can see “image id” as shown below :
To remove a docker image, for example, image id fd484f19954f run the command like :
docker rmi fd484f19954f
There you have it, a quick and safe way to recover disk space from docker. Hope you would like to read about How To Install Docker on Ubuntu.