Back

Docker: no space left on device

The disk hosting ... is full, this may be the cause of the following exception

[ErrorException]
file_put_contents(): write of 8192 bytes failed with errno=28 No space left on device

Troubleshooting

Docker system df

Run the following command to see how much space Docker is using:

docker system df

Possible solutions

Docker disk cleanup

Run the following command for prune options:

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

Run the following command to prune all unused images, not just dangling ones:

docker system prune --all

Make sure you read the output of the command before confirming the removal of images.

WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N]

You can force the command to run without prompting for confirmation:

docker system prune --all --force

Docker volume cleanup

Run the following command to see how much space Docker volumes are using:

docker volume ls

Run the following command to remove all unused Docker volumes:

docker system prune --all --volumes

You can force the command to run without prompting for confirmation:

docker system prune --all --volumes --force

macOS

Docker for Mac

On macOS, Docker for Mac stores images and containers in a single file:

~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

If your Docker.raw does not seem to be in that location you can also find in in the Docker Desktop app in:

Preferences > Resources > Advanced

Run the following command to see how much space Docker for Mac is using (replace the path if necessary):

du -sh ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

If the Docker.raw file is too large and pruning doesn't work you can also manually delete the file and restart Docker for Mac. It will create a new Docker.raw file.

rm ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

References