Docker Devicemapper takes up too much space solution
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
All mirrors and cached resources for Docker are stored in the Devicemapper directory, which can cause this directory to consume a lot of disk and even deplete all of the server's hard drives. As shown in the following illustration:
Solution 1: The failure problem is mainly due to the excessive space allocated, using "Docker info" to view:
First back up the required containers and mirrors, using "Docker save" or "Docker export". then suspend Docker; Delete/var/lib/docker directory, rebuild directory, space allocation mkdir-p/var/lib/docker/devicemapper/devicemapper
DD if =/dev/zero of =/var/lib/docker/devicemapper/devicemapper/data bs = 1M count = 0 seek = 8192
The maximum number of files created is 1M * 8192 = 8G Restart Docker .... Setup failed, no language.
Solution 2: Successfully stop Docker!!! This step is critical, otherwise the following settings will fail. Edit the following file: Vim/lib/systemd/system/docker.service
The original contents are as follows: Execstart=/usr/bin/dockerd-current \ -- Add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \ --default-runtime=docker-runc \ -- Exec-opt native.cgroupdriver=systemd \ -- Userland-proxy-path=/usr/libexec/docker/docker-proxy-current \ $OPTIONS $DOCKER _storage_options \ $DOCKER _network_options $ADD _registry $BLOCK _registry $INSECURE _registry\ $REGISTRIES
That is, add the following 3 lines:--storage-opt dm.loopdatasize=8g \--storage-opt dm.loopmetadatasize=4g \--stora Ge-opt dm.basesize=8g \
Set the Devicemapper data to 8g,metadata 4G, and the mirror size cannot be greater than 8G.
Delete the original Docker and use the DD command to allocate space Rm-rf/var/lib/docker mkdir-p/VAR/LIB/DOCKER/DEVICEMAPPER/DEVICEMAPPER/DD if =/dev/zero of =/var/lib/docker/devicemapper/devicemapper/data bs= 1 M count= 0 seek= 8192 dd if =/dev/zero of=/var/lib/docker/devi Cemapper/devicemapper/metadata bs= 1 M count= 0 seek= 4096
After completing the steps above Systemctl daemon-reload systemctl start Docker Docker info
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.