Are you getting Docker error no space left on the device on your Ubuntu system?
We can help you to fix it. Usually, this error indicates insufficient space in the machine for the docker image to load.
At Bobcares, we often get requests to fix error on Docker, as a part of our Docker Hosting Support.
Today, let’s see how our Support Engineers fix this Docker error.
Why Docker shows the error no space left on the device Ubuntu?
Docker is a platform to build, share and run the application with containers. But, while setting up Docker, the user might come across errors.
Today, let’s discuss the error, ‘failed to register layer: no space left on the device’. The error message indicates that the Docker runs out of space.
Here the error shows up as the System hosting Docker does not have sufficient space. So, let’s see how we troubleshoot and fix this error in the Ubuntu server.
How we fix this Docker error no space left on the device?
Let’s see a few instances when our Support Engineers fixed this error.
Insufficient space in Ubuntu system
Recently one of our customers got the error no space left on device. So we checked the images in the server.
And this appears as,
These multiple images take up useful space in the server.
Hence to remove the image we use the command,
docker rmi <image_id> --force
But, if there are so many images to delete, we use the command,
In addition, by using the filter option we can remove the images created in a specified time.
Creating space by removing container logs
Similarly, the docker needs sufficient space in /var/lib/docker to write into it. So users get an error when the space is insufficient. Hence to create more space in the container, we remove large log files.
Our Support Engineers first list the log files. For this, we use the command,
du -d1 -h /var/lib/docker/containers | sort -h
The output of this command lists the container directories and log size. Hence, to clear the container log we use the command,
cat /dev/null > /var/lib/docker/containers/container_id/container_log_name
But, if there is no root access then we use the below command to prevent permission errors.
sudo sh -c "cat /dev/null > /var/lib/docker/containers/container_id/container_log_name"
Hence this resolves the error.
[Need assistance in fixing Docker errors? – Our Experts are available 24/7.]
Conclusion
In short, the Docker shows no space left on the device in a Ubuntu system when it runs out of space. We saw different situations where a system can run out of space. Today, we saw how our Support Engineers fix this error.
0 Comments