I installed docker on a Debian 7 machine in the following way
$ echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
$
Don't just run the docker prune
command. It will delete all the docker networks, containers, and images. So you might end up losing the important data as well.
The error shows that "No space left on device" so we just need to free up some space.
The easiest way to free some space is to remove dangling images.
When the old created images are not being used those images are referred to as dangling images or there are some cache images as well which you can remove.
Use the below commands. To list all dangling images image id.
docker images -f "dangling=true" -q
to remove the images by image id.
docker rmi IMAGE_ID
This way you can free up some space and start hacking with docker again :)
I had the same error and solve it this way:
1 . Delete the orphaned volumes in Docker, you can use the built-in docker volume command. The built-in command also deletes any directory in /var/lib/docker/volumes that is not a volume so make sure you didn't put anything in there you want to save.
Warning be very careful with this if you have some data you want to keep
Cleanup:
$ docker volume rm $(docker volume ls -qf dangling=true)
Additional commands:
List dangling volumes:
$ docker volume ls -qf dangling=true
List all volumes:
$ docker volume ls
2 . Also consider removing all the unused Images.
First get rid of the <none>
images (those are sometimes generated while building an image and if for any reason the image building was interrupted, they stay there).
here's a nice script I use to remove them
docker rmi $(docker images | grep '^<none>' | awk '{print $3}')
Then if you are using Docker Compose to build Images locally for every project. You will end up with a lot of images usually named like your folder (example if your project folder named Hello, you will find images name Hello_blablabla
). so also consider removing all these images
you can edit the above script to remove them or remove them manually with
docker rmi {image-name}
Docker leaves dangling images around that can take up your space. To clean up after Docker, run the following:
docker image prune [-af if you want to force remove all images]
or with older versions of Docker:
docker rm $(docker ps -q -f 'status=exited')
docker rmi $(docker images -q -f "dangling=true")
This will remove exited and dangling images, which hopefully clears out device space.
Seems like there are a few ways this can occur. The issue I had was that the docker disk image had hit its maximum size (Docker Whale -> Preferences -> Disk if you want to view what size that is in OSX).
I upped the limit and and was good to go. I'm sure cleaning up unused images would work as well.
I also encountered this issue on RHEL machine. I did not find any apt solution anywhere on stack-overflow and docker-hub community. If you are facing this issue even after below command:
docker system prune --all
The solution which worked finally:
you can also use:
docker system prune
or for just volumes:
docker volume prune