You are currently viewing How to Fix Docker No Space Left on Device Issue

How to Fix Docker No Space Left on Device Issue

Docker has changed the way we deploy applications, making it easier to build, ship, and run applications in containers. However, like any technology, Docker isn’t without its challenges. One of the most frustrating issues users encounter is the Docker no space left on device error. In this blog post, we’ll take a look at the causes of this problem and explore solutions to fix it.

SupportFly is one of the reliable docker consulting service providers that can assist you with every step of the procedure if you want to deal with this issue in an easy and trouble-free manner.

What Causes Docker No Space Left on Device?

1. Problems With the Filesystem

  • Disk Space Exhaustion:

The most prevalent cause of the Docker no space left on device error is simply running out of disk space. When your server’s storage is filled to capacity, Docker cannot perform essential operations, leading to errors. This can happen due to various factors, including large log files, data influx, or inadequate allocation of storage space for Docker containers and images.

  • Inefficient Use of Storage:

Docker images and containers can be sizable, especially if they store data or logs. Inefficient management of these resources, such as not removing unused images or containers, can quickly consume available disk space. Over time, this accumulation can lead to the “No space left on device” error.

  • Too Many Containers or Images:

Running an excessive number of containers or storing a vast amount of images on the same system can overload the filesystem. Each container and image requires its share of disk space. When these accumulate significantly, it can lead to exhausted storage.

2. Bind Mount Taking up Space

Bind mounts in Docker allow you to mount a specific directory from the host system into a container. While this feature is useful, it can lead to problems if the mounted directory on the host is filling up. If your Docker container writes a large volume of data into a bind-mounted directory, it can quickly consume available space on the host system. If the host’s file system becomes full, it will cause issues not only for the host but also for the containers relying on these bind mounts.

Also Check: Our blog post on how to list docker containers

3. Common Variations of This Error

  • “No space left on device”:

This error message “Docker No Space Left on Device” is a straightforward indication that the device where Docker is trying to perform an operation is out of storage space. It’s a generic error message that points to the lack of available storage without specifying the exact cause.

  • “Daemon error message: Failed to create mount source path”:

This error occurs when Docker attempts to create a mount source path for a container, but there is not enough space to do so. It specifically indicates a problem with bind mounts or volume mounts where the source path is inaccessible due to lack of space.

  • “Not enough space to download or unpack”:

This error occurs when Docker tries to download or extract an image, but the filesystem lacks the necessary space. It can happen during image pulls, especially if the image being pulled is substantial.

Understanding these causes and error variations is crucial for effectively diagnosing and resolving the “Docker No space left on device” issue in Docker. By addressing these specific problem areas, you can maintain a well-functioning Docker environment and avoid disruptions caused by insufficient storage space.

Also Read: Our blog post on ssh into docker container

What Are Easy Solutions to the Docker No Space Left on Device Error?

1. Running the Docker System Prune Command

What it does: The docker system prune command is a powerful tool to free up disk space. It removes all stopped containers, dangling images, unused networks, and volumes.

How to use it:

How to Fix Docker No Space Left on Device Issue

With the -a option, all unused pictures, not only dangling ones, are deleted. Running this command periodically helps eliminate unnecessary data, reclaiming valuable storage space.

2. Deleting Orphaned Volumes

What it does: Orphaned volumes that aren’t being used by any containers can consume a significant amount of space. Removing them cleans up the storage resources.

How to use it:

How to Fix Docker No Space Left on Device Issue

This command removes all volumes not used by at least one container. Make sure there are no vital data in these volumes before pruning them.

3. Change the Docker Storage Location

What it does: By default, Docker stores its data in the /var/lib/docker directory. Changing this location to a drive with more space can prevent storage issues.

How to do it:

  • Edit the Docker daemon configuration file, usually located at /etc/docker/daemon.json.
  • Add or modify the “data-root” field to specify the new storage location.

Example configuration:

How to Fix Docker No Space Left on Device Issue
  • Restart Docker for the changes to take effect.

4. Deleting the docker.raw File in macOS

What it does: In macOS, Docker uses a large raw file for storage. Removing this file and restarting Docker can resolve space-related issues.

How to do it:

How to Fix Docker No Space Left on Device Issue

After removing the file, restart Docker for the changes to apply. Ensure you don’t have any critical data in your Docker containers before performing this action.

5. Clean Docker

What it does: Regularly cleaning up unused containers and images can prevent storage bloat. Delete containers after use and remove images that you no longer need.

How to do it:

How to Fix Docker No Space Left on Device Issue

Replace <container_id> with the ID of the container you want to remove and <image_id> with the ID of the image you want to delete. Be cautious not to delete important containers or images accidentally.

These easy solutions ensure efficient utilization of disk space and prevent the “Docker No space left on device” error in Docker. This allows you to maintain a smooth and reliable containerized environment. Regular maintenance and monitoring are key to avoiding storage-related problems in Docker.

Check Out: Our blog post on how to list list docker containers

Expanding the File System

If you’re running Docker in a virtual machine, consider expanding the virtual disk size. This process varies depending on the virtualization technology you’re using (e.g., VirtualBox, VMware).

Automating Clean-Up of the Unused Objects

To automate clean-up, you can use tools like Docker Compose, which allows defining services, networks, and volumes in a single docker-compose.yml file. Running docker-compose down -v removes the containers and associated volumes, freeing up space.


The “Docker No space left on device” error in Docker can be exasperating, but armed with the knowledge of its causes and the solutions mentioned above, you can troubleshoot and fix the issue effectively. Regularly cleaning up unused containers, images, and volumes, along with configuring Docker to use a storage location with ample space, will ensure the smooth operation of your Dockerized applications. By implementing these practices, you can prevent this error from disrupting your containerized workflows, enabling you to make the most out of Docker’s flexibility and efficiency.