16

I am currently trying to create docker image with python files and lot of extra packages in requirement.txt.

While I am running the command "sudo docker build -t XXX ." the packages are downloaded and than installed one by one untill I receive an error: "Could not install packages due to an EnvironmentError: [Errno 28] No space left on device"

I have already did the atomic option of "sudo docker system prune" and all the past docker images are deleted.

Moreover, "sudo docker info" shows that I have 15 GB allocated to docker and while my unsuccesfull docker image size is 1 GB size it is still well below the total memory.

None of the options mentioned here: https://unix.stackexchange.com/questions/203168/docker-says-no-space-left-on-device-but-system-has-plenty-of-space or here: Docker error : no space left on device worked. I can create several "failed" dockers of ~1GB with the total size of more than 20GB so it is not an issue of lack of space on my HDD of VM. So I would be grateful for some more ideas.

TylerH
  • 20,799
  • 66
  • 75
  • 101
0xtuytuy
  • 1,494
  • 6
  • 26
  • 51

2 Answers2

31

The disk partition used by Docker is becoming full during the build. You can see the available and used space on your partitions using df -h. You can either add more space to that partition or you need to clean more files.

The docker system prune only removes unused data (dangling images, unreferences volumes ...). You can clean more space, by deleting images that you don't need. I suggest you take a look at the images you have using docker image ls and explicitly delete unneeded ones using docker image rm <image>.

yamenk
  • 46,736
  • 10
  • 93
  • 87
  • 1
    got the same error although the `data_root` is configured to a large partition and after pruning. The only explanation I find is that docker creates temp files on my (small) root partition while building. Is it possible to change that in the config ? – Robycool Apr 23 '21 at 10:02
  • 1
    You just saved mi computer! 25 GB in trash images! – RicHincapie Nov 05 '21 at 21:09
4

If you are using Docker Desktop on Mac, go to Preferences and increase the Disk image size. In my case it was displaying that it was full Disk image size: 59.6 GB (59.6 GB used).

Pavle
  • 157
  • 1
  • 11
  • 3
    Thanks for offering the answer. But you refer to a Preferences option for Docker Desktop. Are you perhaps on a Mac? I am on Windows and don't see that (I see "Settings"...but even in there we have no option to modify the disk size except via a config file.) I'm simply proposing that if you ARE on a Mac, it seems it would help future readers if you simply tweaked the answer to add "on macOS", before your first comma. – charlie arehart Nov 23 '21 at 16:07