Reputation: 1625
The docker my team and I are using is frequently running out of space. Usually we fixed this by deleting the dangling images. But now at the moment there are 5 running containers with 7 images and the memory is full. Even the log file can't write its output. So as I described there are like 15 images (docker images --all), but when I type docker info
it says that there are 132 images.
root@dockersrv:/var/lib/docker# docker info
Containers: 10
Images: 132
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 154
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.16.0-30-generic
Operating System: Ubuntu 14.04.3 LTS
CPUs: 2
Total Memory: 15.67 GiB
Name: dockersrv
ID: ``
WARNING: No swap limit support
As far as I remeber, somebody manged to delete the registry container, and we created a new one. My thoughts are that all of these images are associated with the old registry. So any idea how to delete them and free up some space. Any other advices about how to increase its memory and what to perform apart deleting dangling images and old containers would be much appreciated.
Upvotes: 0
Views: 808
Reputation: 30723
docker images -a
will show all your images. But this will also contain child images of your existing images.
The first steps to 'clean up' your docker environment is to delete the stopped docker containers which are showed when you perform docker ps -a
. You can not delete docker images as long as an instance of an image (container) exists. Even when it's not running anymore.
docker rm -v `docker ps -a`
After deleting the stopped containers you're able to delete unused images with for example:
docker images -q |xargs docker rmi
As you can see there are multiple ways/commands to delete your containers and images.
The -v
option (used when deleting containers) will delete the container volume which is also an important part.
The docker volumes are stored in /var/lib/docker/volumes
and this contains the content of your containers. In the question was some issue about an old registry which was deleted. Than it's very important to check if the volume of the registry is also deleted.
In the newer versions of docker you can delete dangling volumes with:
docker volume rm `docker volume ls -q -f dangling=true`
You can also just delete the right folder + restart docker.
sudo rm -r /var/lib/docker/volumes/the-specific-volume
Upvotes: 2