I am simply trying to export a Docker image that I have so that I can push it to another system; however, I cannot even save it because of no space:
$ docker save mycustomimage:latest -o nessus.tar
Error response from daemon: write /var/lib/docker/tmp/docker-export-255300778/f2881cc25962de53a9f4efdbf759e88c86bd183abf773477ebbd5ddebc229ae8/layer.tar: no space left on device
However, if I run df -h, I can confirm that I have over 150GB of free space:
$ df -h
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk1s1 466Gi 275Gi 182Gi 61% 1290334 9223372036853485473 0% /
devfs 374Ki 374Ki 0Bi 100% 1296 0 100% /dev
/dev/disk1s4 466Gi 8.0Gi 182Gi 5% 8 9223372036854775799 0% /private/var/vm
map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
drivefs 466Gi 292Gi 173Gi 63% 18446744069414640546 4294967295 32808793364899312% /Volumes/GoogleDrive
here's a list of the images:
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
mycustomimage/kali latest a1f226987b86 12 hours ago 33GB
mycustomimage/kali <none> ac3292dcbd65 4 months ago 25.1GB
mycustomimage/kali <none> 8a628403a803 6 months ago 12GB
I am not even sure if all of these images are 33GB combined, or 33GB is just the file size of the last image. It's just a simple Kali Linux docker with one custom tool on it that is about 5GB in space. I'm pretty sure that, if this image is 70GB large, then it's larger than my VM which has even more stuff installed.
Your df -h output corresponds with the output that I would expect to see on a mac, which means your linux containers are not running on the system where df -h was run.
If you are running the Docker Desktop for mac, then your docker daemon is running inside a hyperkit virtual machine that the whale icon Docker.app application manages in the background. This virtual machine includes a virtual disk with a finite size. The smallest configurable disk size for this disk image is 16GB. To see how much space your whale icon docker desktop managed virtual machine has, click on the whale icon, and choose "Preferences". Under the "Disk" tab, you will see how big the disk is, and how much space it is taking up (due to compression).
When the docker save command is run, the daemon will create a .tar at the location referenced in your error output, /var/lib/docker/tmp/.... Since your virtual machine's disk does not have enough space for that temporary .tar file, you get a disk out of space error.
To see the true amount of space available to the VM, run the following command:
docker run --rm -it -v /var/lib/docker/tmp:/r alpine df -h /r
It is possible to increase the amount of space your disk image has available to it, but keep in mind that will take up real space on your hard drive even once the large files are deleted from the filesystem on the disk image.
tldr; you are running docker in a virtual machine that has less space available to it than your host machine shows as available.
I pruned some images and containers and after that it worked.
docker image prune
and
docker container prune