47

Using Docker 1.13.0 (9795) under Windows 10 Build 14393, I'm getting "no space left on device" when trying to run the latest python image (which would be 3.6):

> docker run -it python
Unable to find image 'python:latest' locally
latest: Pulling from library/python
5040bd298390: Pull complete
fce5728aad85: Pull complete
76610ec20bf5: Pull complete
52f3db4b5710: Extracting [==================================================>] 129.8 MB/129.8 MB
45b2a7e03e44: Download complete
75ef15b2048b: Download complete
e41da2f0bac3: Download complete
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: failed to register layer: Error processing tar file(exit status
 1): write /usr/share/doc/libfreetype6/reference/ft2-type1_tables.html: no space left on device.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

There's over 20 GB free on the hard drive, so I assume the problem is inside Docker's virtual machine. How do I access it to investigate disk usage and clean up if needed?

docker images and docker ps -a didn't identify anything large:

> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              f49eec89601e        2 days ago          129 MB
d4w/nsenter         latest              9e4f13a0901e        4 months ago        83.8 kB
> docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
ae1e7c7b11ed        ubuntu              "/bin/bash"         10 minutes ago      Exited (0) 9 minutes ago                       quirky_rosalind

Pulling separately didn't help:

> docker pull python
Using default tag: latest
latest: Pulling from library/python
5040bd298390: Pull complete
fce5728aad85: Pull complete
76610ec20bf5: Pull complete
52f3db4b5710: Extracting [==================================================>] 129.8 MB/129.8 MB
45b2a7e03e44: Download complete
75ef15b2048b: Download complete
e41da2f0bac3: Download complete
failed to register layer: Error processing tar file(exit status 1): write /usr/bin/g++-4.9: no space left on device
max
  • 49,282
  • 56
  • 208
  • 355
  • 1
    Docker pulls image to the tmp directory. Are you sure that it has enough free space too? – AstraSerg Jan 23 '17 at 19:54
  • @AstraSerg well, I'm on a Windows system with a single logical and physical hard drive with plenty of space; there's no `/usr` directory on it. I'm sure docker is referring to the linux file system inside its own virtual machine. I am guessing there is *not* enough space in it, but I don't know how to ssh into that VM to check, or how to change the amount of disk space allocated to the VM. Hence this question. – max Jan 23 '17 at 20:26
  • 3
    `sudo docker image prune -f && sudo docker container prune -f ` This cleans up the dangling images and dead containers. – Bill Cheng Nov 14 '17 at 20:33
  • @max, were you able to find a solution? This still seems to be an issue after almost two years – priteshbaviskar Jan 08 '19 at 08:10
  • @22kar sorry no, haven't used docker much. – max Jan 08 '19 at 13:04
  • 1
    @BillCheng is correct. And also restart the docker client on your instance. Docker is really bad with memory management. So `docker rmi` whatever you don't need, and then restart. – DUDANF Jan 09 '20 at 11:48

7 Answers7

42

If you're using Docker Desktop on OSX (or similar), you can get around this by accessing the Preferences, increasing the base image size, and click "Apply and Restart"

enter image description here

Pezholio
  • 2,439
  • 5
  • 27
  • 41
22

you can use this command to see if you have hide images.

docker image ls -a

and if you want to remove all of them you can use this command :

docker rmi -f $(docker image ls -a -q)

you know sometimes images files are stored in hard disk and then it cause low capacity.

ali Falahati
  • 599
  • 7
  • 18
13

I encountered this error today.

docker prune, docker rmi ..., df -h , df -ih and so may good but the reason is docker devicemapper Base Device Size . the docker info command give info about that.

I refer to this for a complete explanation.

however, these steps would solve the problem:

systemctl stop docker.service
dockerd --storage-opt dm.basesize=20G
(you should terminate the command with Ctrl+C)
service start docker
Hossein Vatani
  • 1,381
  • 14
  • 26
  • 4
    docker not starting anymore. getting this error `Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?` – Gerald Hughes Sep 03 '21 at 11:57
10

You will need delete all containers that were stopped as well as all volumes and networks and that are not used by any container. It will also remove all dangling images.

docker system prune
julia7
  • 101
  • 1
  • 2
  • as per official docs: https://docs.docker.com/config/pruning/#prune-everything You must specify the --volumes flag for docker system prune to prune volumes – Sam AlGhamian Jan 09 '23 at 20:52
3

I was facing the same issue. But resolved this:

By docker system df command, I checked image size it was showing 104 MB, so the error No space left on device.

Then I just restarted the docker through setting and again check by docker system df, now this time it was showing size in GB.

juanlumn
  • 6,155
  • 2
  • 30
  • 39
1

The error is because of the mount volume , Execut efollowing commands

df -h

In the docker check the overlay mount directory

Filesystem                        Size  Used Avail Use% Mounted on
devtmpfs                          3.7G     0  3.7G   0% /dev
tmpfs                             3.7G   16K  3.7G   1% /dev/shm
tmpfs                             3.7G   33M  3.7G   1% /run
tmpfs                             3.7G     0  3.7G   0% /sys/fs/cgroup
/dev/mapper/VolGroup00-rootVol     10G  2.3G  7.8G  23% /
/dev/nvme0n1p1                   1014M  334M  681M  33% /boot
/dev/mapper/VolGroup00-homeVol    3.0G   33M  3.0G   2% /home
/dev/mapper/VolGroup00-varVol     4.0G  3.5G  588M  86% /var
/dev/mapper/VolGroup00-tmpVol     2.0G   58M  2.0G   3% /tmp
/dev/mapper/VolGroup00-logVol     4.0G   36M  4.0G   1% /var/log
/dev/mapper/VolGroup00-auditVol   4.0G   98M  3.9G   3% /var/log/audit
/dev/mapper/VolGroup00-vartmpVol  2.0G   33M  2.0G   2% /var/tmp
tmpfs                             753M     0  753M   0% /run/user/1000
overlay                           4.0G  3.5G  588M  86% /var/lib/docker/overlay2/82b544ac4a868c7f3c0180c4751e73084f64785c379362bf0fcf6c07f36cb36e/merged
tmpfs                             753M     0  753M   0% /run/user/0

Ry-
  • 218,210
  • 55
  • 464
  • 476
Tapan Banker
  • 587
  • 1
  • 7
  • 10
  • 1
    what do I do with/to the overlay directory? How can I use this information to resovle my problem please – S.. Dec 05 '22 at 09:08
0

I faced a similar issue recently, and this was because I had a lot of dangling, not used by any container, images that use a lot of disk space. to remove them I used the following command:

sudo docker image prune -a
Sam AlGhamian
  • 73
  • 2
  • 12