Docker no space left on device

hello,

this error show up when i try to pull elasticsearch

image

if any one have any idea please help

Docker engine uses /var/lib/docker to store the images and container runtime environment.

Looks like the disk mounted to /var/lib/docker is full. You can verify the size using the command du -sh /var/lib/docker.

Few options you have are -

  • Mount a disk with a good amount of space based on the number of images & applications you are running.

  • Remove unused images or stopped containers completely to obtain some free space.
    Few commands that helps are $ docker image rm <image-name/image-id> and $ docker container rm <container-name/container-id>

1 Like

You can run a docker system prune --all --force command to do some cleanup.

$ docker system prune --help

Usage:	docker system prune [OPTIONS]

Remove unused data

Options:
  -a, --all             Remove all unused images not just dangling ones
      --filter filter   Provide filter values (e.g. 'label=<key>=<value>')
  -f, --force           Do not prompt for confirmation
      --volumes         Prune volumes
$ docker system prune --all
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all dangling build cache

To skip the prompt:

docker system prune --all --force

To delete volumes currently not being used by a running or stopped container:

docker system prune --all --force --volumes
3 Likes

Also, that space could also be taken up by volumes.
Run a docker volume ls to see.

1 Like

Does docker info | grep Filesystem return ext4?

Ext4 knows a different type of ‘no space left’, which occours if the filesystem has no entries left in the inode index. I have experienced inode exhaustion on ext4 formated filesystems in the past. Never had the problem with xfs (though, it needs to be formated with a special flag in order to work with overlay2 as sorage driver).

I have also no space on my disk. I’m talking like 20GB daily.
I know it is logs because I do:
sudo -i find /var/snap/docker/common/var-lib-docker/ -type f -name “*.log” -delete
and recover the missing space. But this is only half of the process until ubuntu show me the free space again. After 1 week repeat :frowning:
so is there a solution to stop all this logs in var-lib-docker ?

Is there any solution for this? no matter how many space you have on your HD, it will run out with all these logs on overlay2.
How can I stop this?
docker system df shows:
5GB on Images and containers just 14MB. but then /var/lib/docker/overlay2 increases massively everyday.

The solution is to handle the logs on disk. It’s not a docker issue. You need to configure logrotate.d or equivalent for the logs to be managed automatically.

the docker system prune --all --force --volumes worked to claim the space that I didn’t know about before. Thanks and cheers!