Data migration for docker storage management

Data migration for docker storage management

background:

It is often found that the docker in the server has been used for a long time, and the data is stacked too much, causing the disk to burst. Then backing up the data of the docker service has become a problem that needs to be solved.

status quo:

It can be seen in the figure that /dev/vda1 has occupied 99% of the disk root directory

Insert picture description here
View docker resource usage:

docker system df

Insert picture description here
By default, docker resource data is stored in:

/var/lib/docker

A) Link method of data migration:

1) Find a free disk and mount it to /mnt

Insert picture description here

2) Move /var/lib/docker to /mnt (stop docker in advance)

3) Create a soft connection: ln -s /mnt/docker /var/lib/docker

Insert picture description here

4) Restart the docker service and check: docker images

Insert picture description here
Finally: the server disk has been vacated
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43010385/article/details/112910946