I\'ve just noticed that I ran out of disk space on my laptop. Quite a lot is used by Docker as found by mate-disk-usage-analyzer
:
The docker/
I had same issue. In my case solution was:
view all images:
docker images
remove old unused images:
docker rmi IMAGE_ID
possibly you will need to prune stopped containers:
docker container prune
p.s. docker --help is good solution :)
The following is a radical solution. IT DELETES ALL YOUR DOCKER STUFF. INCLUDING VOLUMES.
$ sudo su
# service docker stop
# cd /var/lib/docker
# rm -rf *
# service docker start
See https://github.com/moby/moby/issues/22207#issuecomment-295754078 for details
The docker location might be different in your case. You can use a disk usage analyzer (such as mate-disk-usage-analyzer
) to find the folders which need most space.
See Where are Docker images stored on the host machine?
This dir is where container rootfs layers are stored when using the AUFS storage driver (default if the AUFS kernel modules are loaded).
If you have a bunch of *-removing
dirs, this is caused by a failed removal attempt. This can happen for various reasons, the most common is that an unmount
failed due to device or resource busy
.
Before Docker 17.06, if you used docker rm -f
to remove a container all container metadata would be removed even if there was some error somewhere in the cleanup of the container (e.g., failing to remove the rootfs layer).
In 17.06 it will no longer remove the container metadata and instead flag the container with a Dead
status so you can attempt to remove it again.
You can safely remove these directories, but I would stop docker first, then remove, then start docker back up.
docker takes lot of gig into three main areas :
Check for downloaded and compiled images. clean unused and dead images by running below command
$docker image prune -a
Docker creates lot of volume, some of the volumes are from dead container that are no more used clean the volume and reclaim the space using
$docker system prune -af &&
docker image prune -af &&
docker system prune -af --volumes &&
docker system df
Docker container logs are also very notorious in generating GBs of log overlay2 storage for layers of container is also another source of GBs eaten up . One better way is to calculate the size of docker image and then restrict the docker container with below instructions for storage and logs upper cap. For these feature use docker V19 and above.
$docker run -it --storage-opt size=2G --log-opt mode=non-blocking --log-opt max-buffer-size=4m fedora /bin/bash
Note that this is actually a know, yet still pending, issue: https://github.com/moby/moby/issues/37724 If you have the same issue, I recommend to "Thumbs Up" the issue on GitHub so that it gets addressed soon.