Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that Docker occupies full partition in Linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Today, I encountered a problem. When I accessed the database, I found that I could not access it and burst the error that there was not enough storage space, and then enter the command:

Df-h

It is found that / dev/vda1, that is, the system disk is full. Not a full-time operation and maintenance, so, began to Baidu to solve the problem. Here is the solution path:

The first is to find the storage location of large files. After finding some directories through the command du-sh / *, we found that several directories are particularly large, such as / var.

Then confirm the partition, df / var, and find that the partition of this directory is / dev/vda1, so go to this directory and start deleting things. I started to delete a lot of logs, but found that it didn't work much, so I used the command again: du-sh *

It is found that the / lib/docker folder occupies the largest amount under the / var directory, so you know where the problem lies. The images and containers of docker are placed under the directory / var/lib/docker by default, occupying 6.6g.

The next problem is to solve the problem that docker takes up too much space, so the initial idea is to delete unwanted containers and images, but it is tragic that the space has not been reduced. So, I started the second idea, which is to export the images and containers I need, but what is more tragic is that there is not enough space to export.

Because the mirror image has been done for a long time, I don't want to give it up easily. After thinking about it for a long time, I finally came up with an idea. First move the / var/lib/docker folder out, and then reset the data storage location of docker.

The steps are as follows (CentOS):

/ etc/init.d/docker stop # closes dockermv / var/lib/docker / home/docker # data moved out of docker (the home directory is not mounted on the system disk). At this point, the problem of the system disk is solved.

Then set docker is the data storage location, edit the / etc/sysconfig/docker file, and add the setting of the-g parameter, as follows:

Other_args= "- g / home/docker"

Start docker

/ etc/init.d/docker start

At this point, the problem is solved.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report