Use the find command to find files larger than a specified size: find / -type f -size +10G Exclude a directory find / -path "/media/xww" -type f -size +10G How to modify the storage location of Docker local images and containers Method 1: Soft link By default, Docker is stored in: /var/lib/docker sudo docker info | grep "Docker Root Dir" The most direct way to solve this problem is of course to mount the partition to this directory, but my data disk has other things, which is definitely not easy to manage, so I use the method of modifying the storage path of the image and container to achieve the goal. This method will be implemented through soft connection. First stop the Docker service: systemctl restart docker Or service docker stop Then move the entire /var/lib/docker directory to the destination path: mv /var/lib/docker /root/data/docker ln -s /root/data/docker /var/lib/docker At this time, when you start Docker, you will find that the storage directory is still /var/lib/docker, but it is actually stored on the data disk. You can see the capacity changes on the data disk. Method 2: Expandable logical volume By default, the docker storage location is: a. Create a new partition and format it. PS: The following operations assume that you already have an existing volume group and can directly create a logical volume. Or you can create a logical volume yourself, or use partitions directly without using logical volumes: lvcreate -L 300G lv_docker vg_home mkfs.ext4 /dev/vg_home/lv__docker b. Mount the new partition to the temporary mount point [plain] view plain copy mkdir /mnt/docker mount /dev/vg_home/lv_docker /mnt/docker/ c. After stopping docker, copy the data under /var/lib/docker to the temporary mount point [plain] view plain copy service docker stop cp -r /var/lib/docker/* /mtn/docker d. Modify /var/lib/docker to //var/lib/docker.bak and create /var/lib/docker [plain] view plain copy mv /var/lib/docker{,.bak} mkdir /var/lib/docker e. Mount the new partition to /var/lib/docker and set it to mount automatically at boot. [plain] view plain copy mount /dev/vg_home/lv_docker /var/lib/docker vim /etc/fstab --- /dev/vg_home/lv_docker /docker_data ext4 defaults 0 0 ---- f. Check whether docker is available and whether the data is complete [plain] view plain copy docker images docker ps -a g. After confirmation, uninstall the temporary mount point and delete /var/lib/docker.bak [plain] view plain copy umount /mnt/docker rm -rf /var/lib/docker.bak Method 3: Modify the storage path of images and containersThe parameter for specifying the image and container storage path is –graph=/var/lib/docker. We only need to modify the configuration file to specify the startup parameters. The Docker configuration file can set most of the background process parameters. The storage location in each operating system is different. The location in Ubuntu is: /etc/default/docker, and the location in CentOS is: /etc/sysconfig/docker. If it is CentOS, add the following line: OPTIONS=--graph="/root/data/docker" --selinux-enabled -H fd:// If it is Ubuntu, add the following line (because Ubuntu does not enable selinux by default): OPTIONS=--graph="/root/data/docker" -H fd:// # or DOCKER_OPTS="-g /root/data/docker" Finally, restart and the Docker path will be changed to /root/data/docker. vim /etc/default/docker Add configuration information DOCKER_OPTS="--graph=/home/docker" Save and exit service docker restart Found that the configuration did not take effect solution: mkdir -p /etc/systemd/system/docker.service.d cat /etc/systemd/system/docker.service.d/Using_Environment_File.conf If the file does not exist, create it yourself and add the following content [Service] EnvironmentFile=-/etc/default/docker ExecStart= ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS Load configuration and restart service systemctl daemon-reload service docker restart Check whether the configuration is effective This is the end of this article about Docker configuration of local images and container storage locations. For more information about Docker configuration of local images and container storage locations, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Summary of basic operations for MySQL beginners
>>: Comparing Document Locations
This article example shares the specific code of ...
FileReader is an important API for front-end file...
This article example shares the specific code of ...
System environment: centos7.4 1. Check whether th...
The overall architecture of MySQL is divided into...
Table of contents Preface Installation and Usage ...
When we make a form, we often set a submit button ...
1. Create a new virtual machine from VMware 15.5 ...
I encountered a requirement to customize shortcut...
The default submission method of html is get inste...
Table of contents 1 Node.js method of sending ema...
Preface Everyone knows how to run a jar package o...
Table of contents Project Background Improvement ...
Table of contents 1. What is recursion? 2. Solve ...
1. Overview I searched a lot online and found tha...