How do I fix Docker no space left on the device?

To use storage drivers successfully, you must first understand how Docker creates and saves images and how containers use these images. You can use this data to make informed decisions about besting data from your applications while avoiding performance issues. Storage drivers enable you to write data to your container’s writable layer. After the container is destroyed, the files are not saved, and read and write rates are slower than native file application performance. You may want to clean up your system’s hard drive to download and run the Docker image. However, if you don’t have enough space on your hard drive, you could get the error: no space left on the device. When your server is clogged with garbage files, it can affect the PC to slow down. You will need to reclaim a specific quantity of space to fix it. The Dot cloud container engine requires relatively simple scripting to clear storage. This issue usually indicates that Docker is running out of space. /var/lib/docker is where it stores its data. That directory must have adequate free space on whatever file system it is mounted on. In this tutorial, you will learn different methods to fix “Docker no space left on device”.


To fix “Docker no space left on device”, you have to use the Ubuntu 20.04 Linux system and docker installation in it. If Docker is not installed, you can do it with the help of the below-listed command in the terminal

$ sudo apt install

Method to fix “Docker no space left on device”

You have to log in via sudo user and open the command line terminal by checking it in your operating system’s application area or using the “Ctrl+Alt+T” shortcut key. Once opened, follow all these methods described in this article.

Method 1: Docker System Prune

The ‘docker system prune command is being used to eliminate or delete unutilized objects or data, including images, containers, volumes, and networks. These objects are not erased unless we consciously remove them; even so, in docker 17.06.1 or higher, we must require the ‘–volumes’ possibility to remove volumes. It eliminates both dangling and unreferenced images; however, only by default are dangling images removed. The ‘docker system prune’ can only be used with a client and daemon API version of 1.25 or higher. Now execute the listed command:

$ sudo docker system prune

You have to provide your sudo user password for its successful execution. Upon execution, you will get the following warning, as shown in the attached image. You have to enter “y” to go on with the process. When we implement the ‘docker system prune command, it sends an API request to the Docker daemon, which looks for all unused items on the host and eradicates them from the system. Since earlier versions of Docker removed all objects, including volumes, the ‘–volumes’ option was added.

Method 2: Removing Dangling Images

The volume command in Docker can be used to accomplish this. Because this erases any directory or folder in /var/lib/docker/volumes that are not a volume, you must ensure that no important documents are saved there. When creating a Docker image, there are usually numerous layers of images. Layers that have no reference to any tagged picture are referred to as dangling images. Dangling images take up storage space but do nothing. To view a list of all volumes, use the command:

$ sudo docker volume ls

Use the following command to get a list of all dangling volumes:

$ sudo docker volume ls –qf dangling=true

You have to provide your sudo user password for its successful execution.

Method 3: Removing Orphaned Volumes

To get started, you will need to erase any orphaned volumes in Docker. Now to get rid of all orphaned volumes, execute the following command:

$ docker volume rm


In this guide, we have discussed a few methods to eliminate the “Docker no space left on device” error. Now, I believe you can easily tackle this at your end by following this tutorial.

About the author

Kalsoom Bibi

Hello, I am a freelance writer and usually write for Linux and other technology related content