View Disk Usage# du -hs /var/lib/docker/ 237G /var/lib/docker/ # docker system df TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 7 2 122.2GB 79.07GB (64%) Containers 2 2 61.96GB 0B (0%) Local Volumes 0 0 0B 0B Build Cache 0 0 0B 0B Disk Cleanup (Do Not Use It Lightly)# The docker system prune command can be used to clean up disks, delete closed containers, unused data volumes and networks, and untagged images. # The docker system prune -a command can delete all Docker images that are not used by containers. Note that these two commands will delete the temporarily closed containers and the Docker images that are not currently in use. Migrate data【Stop Docker】 # systemctl stop docker Create a new docker directory # mkdir -p /home/docker/lib Migrate the /var/lib/docker directory (Note: You can directly mv, make sure the disk is large enough) # rsync -avz /var/lib/docker /home/docker/lib/ 【Add configuration】 Check whether /etc/systemd/system/docker.service.d/devicemapper.conf exists. If it does not exist, create it. # mkdir -p /etc/systemd/system/docker.service.d/ # vi /etc/systemd/system/docker.service.d/devicemapper.conf (Note: devicemapper.conf adds configuration: when syncing, the parent folder should be synchronized together. The actual directory should be in /home/docker/lib/docker ) [Service] ExecStart= ExecStart=/usr/bin/dockerd --graph=/home/docker/lib/docker [Reload Docker] # systemctl daemon-reload # systemctl restart docker # systemctl enable docker Check docker info # docker info | grep "Docker Root Dir" Is it changed to: /home/docker/lib/docker Check the image # docker images 【Cleaning up original data】 After confirming that the container is OK, delete the files in the /var/lib/docker/ directory. # rm -rf /var/lib/docker This is the end of this article about the methods and steps of docker migration data directory. For more relevant content about docker migration data directory, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Why is the disk space still occupied after deleting table data in MySQL?
A common development need is that we want to coll...
There are always some problems when configuring n...
When optimizing a website, we must learn to use e...
Background-image is probably one of those CSS pro...
Many times when we process file uploads, such as ...
CSS transformations, while cool, have not yet bee...
This article mainly describes how to implement fo...
I was recently working on a project at the compan...
Table of contents 1. Primary key exists 2. No pri...
After a long period of transplantation and inform...
First, let’s take a look at the picture: Today we...
The following code introduces MySQL to update som...
1. Trash or Classic? Web technology updates very ...
Routing configuration commands under Linux 1. Add...
After Ubuntu 20.04 is installed, there is no root...