How to fix Docker error no space left on device when disk is not full?


This post presents a solution to an error I encountred recently with Docker when trying to bring up my docker container. The error I got from Docker said “no space left on device”.

This particular docker setup had been working previously fine up until this point, I did not make any significant changes that would affect my setup.

docker | * /etc/init.d/mysql: ERROR: The partition with is too full!

webapp  |  * /etc/init.d/mysql: ERROR: The partition with  is too full!

webapp  | ERROR 3680 (HY000) at line 3: 
Failed to create schema directory 'database' 
(errno: 28 - No space left on device)

I will provide two possible solutions for the “docker no space left on device” problem, when in fact there is space on your hard disk.

Solution 1: System Prune

The first thing to try is to prune docker images, and containers. Start up your docker containers, then issues the command below to prune.

> docker system prune -a

WARNING! This will remove:
- all stopped containers
- all volumes not used by at least one container
- all networks not used by at least one container
- all images without at least one container associated 
	to them Are you sure you want to continue? [y/N]

You simply have to continue, and docker system will be pruned.

Solution 2: Increase Docker Space

What if you continue to get no space left on device after prune?

Docker Increase Image

If after performing the docker system prune as detailed in the above step, the next step is to increase the space docker can use.

In the examples I have shown below use are for the docker-desktop appliction.

To increase the space on MacOS, open docker desktop application, navigate to settings,

docker settings

Then navigate to resources,

docker settings resources

You can increase the size of disk that docker uses

docker disk image size

Then click apply and restart.

docker apply

You can read more about how I have used docker in my other projects.

Creating your first programming language is easier than you think,
...also looks great on your resume/cv.