Reputation: 211
I am trying to build a docker image (using my Dockerfile) and I get a very strange error about insufficient space in the download directory:
Total download size: 208 k
Installed size: 760 k
Downloading packages:
Error downloading packages:
libyaml-0.1.4-11.el7_0.x86_64: Insufficient space in download directory /var/cache/yum/x86_64/7/centos/packages
* free 0
* needed 55 k
PyYAML-3.10-11.el7.x86_64: Insufficient space in download directory /var/cache/yum/x86_64/7/centos/packages
* free 0
* needed 153 k
The command '/bin/sh -c yum -y install python-yaml' returned a non-zero code: 1
I am using a centos7 base image
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 106M 1.5G 7% /run
/dev/sda1 118G 112G 0 100% /
tmpfs 7.9G 648K 7.9G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/sdb1 92G 206M 87G 1% /boot
tmpfs 1.6G 56K 1.6G 1% /run/user/1001
Upvotes: 20
Views: 17320
Reputation: 357
The following command works for me:
docker system prune
This will allow you to prune all the dangling images, dangling build caches, networks that are not in use.
Upvotes: 4
Reputation: 6018
For me, running:
docker image prune
did the trick. It turned out I had lots of garbage (a.k.a., dangling) images taking up space. prune
docs can be found here.
Upvotes: 17
Reputation: 4693
You would need to check where the space was used at first.
du -h /var | grep -E ‘^[0-9.]*[M|G]’
If any specific directory is used too much spaces, you check how to remove it properly. And you do it.
You ever have not removed docker containers or images? It usually is high possibility for root cause of the unsufficient space issues.
Check it by following command.
du -hs /var/lib/docker
If the directory has too much spaces, you would solve docker commands below.
Removing all containers,
docker rm $(docker ps -qa)
Removing docker all images,
docker rmi $(docker image ls -qa)
But the cause may not be the docker around, such as big log files or rpm cache and some big files. And then you can remove the files.
I hope this help you.
Upvotes: 3
Reputation: 9398
The following docker
command was the trick to fix the underlying error for me:
$ docker rm $(docker ps -qa)
Upvotes: 45
Reputation: 19268
Check and make sure the /var directory has sufficient space as that is where docker
stores its images.
To do so: df -h /var
If it is 100% full you might want to clear up some space.
docker ps -a
- to list all of the containers (including those stopped and exited ones). use docker rm {CONTAINER_ID}
to free up some space.
Alternatively do docker images
to remove unused images. docker rmi {IMAGE_ID}
.
Upvotes: 6