Docker Devicemapper takes up too much space solution

Source: Internet
Author: User
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

Then modify it to the following: 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 \            --storage-opt dm.loopdatasize=8g \           -- Storage-opt dm.loopmetadatasize=4g \           --storage-opt dm.basesize=8g \            $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


Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.