Docker 101 : Low storage - Troubleshooting docker disk usage issues -
History of docker images:
Docker images are composed of different layers.
The "history" of an image include all the steps involved in making the layers that make up the image.
before we check the "history" of an image, we need to list the images we have on the system:
We can display the history of an image (ID : e7d08cddf791) by running the below command:
The command above shows the list of steps (history) that were followed to create the image.
We could also use the command:
We can use the first characters (e7 instead of e7d08cddf791) of the image as long as they are unique.
Docker component disk resources usage:
Depending on the storage driver, the below folders could be found in other directories - we use the overlay2 storage driver here - :
These folders corresponds to different image layers we have built on our machine.
For the "aufs" storage driver, the above directories could be found in "/var/lib/docker/aufs/diff" for example.
Detailed overview of disk usage for different docker resources :
We can have a better view of the disk usage for the different docker resources (images, containers, volumes, ...) using the below command:
Removing unused resources:
We can then decide to remove the unused resources using the below command:
Docker volumes are not deleted by default to prevent data from being removed.