Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker image error downloading package

Tags:

docker

pip

centos

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
like image 587
jono Avatar asked Aug 08 '16 03:08

jono


3 Answers

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.

like image 100
asherbret Avatar answered Nov 06 '22 01:11

asherbret


The following docker command was the trick to fix the underlying error for me:

$ docker rm $(docker ps -qa)

like image 28
Saheed Avatar answered Nov 06 '22 00:11

Saheed


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}.

like image 6
Samuel Toh Avatar answered Nov 06 '22 00:11

Samuel Toh