Docker Storage Settings

Source: Internet
Author: User

Docker default single container can use data space size 10gb,docker available data total space 100GB, metadata available total space 2GB. Use the Docker info information to view information such as data space total, Metadata space, and more:

[[email protected] sysconfig]# docker infoContainers: 23Images: 45Storage Driver: devicemapper Pool Name: docker-8:36-13501344-pool Pool Blocksize: 65.54 kB Data file: /var/lib/docker/devicemapper/devicemapper/data Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata Data Space Used: 1.684 GB Data Space Total: 107.4 GB Metadata Space Used: 2.699 MB Metadata Space Total: 2.147 GB Library Version: 1.02.89-RHEL6 (2014-09-01)Execution Driver: native-0.2Kernel Version: 2.6.32-504.el6.x86_64Operating System: <unknown>CPUs: 24Total Memory: 47.09 GiBName: docker-01ID: S3F6:VR2L:WH7X:QLQO:RH6P:EVBT:QRUW:NNMV:4MQ7:YADK:Q6OV:Q2IQ[[email protected] sysconfig]#

The size of the local file system is the following (data holds the image and container, metadata is the basic information such as tag, name, status):

[[email protected] ~]# ll /var/lib/docker/devicemapper/devicemapper/ -htotal 35G-rw------- 1 root root 100G Jun  5 13:43 data-rw------- 1 root root 2.0G Jun  5 13:43 metadata[[email protected] ~]#

You can use DF-HT to see the amount of space the container can use, about 10GB below (the same data block, different file system size differences)

[[email protected] ~]# docker exec zhijie df -hTFilesystem           Type    Size  Used Avail Use% Mounted onrootfs               rootfs  9.8G  1.8G  7.5G  20% //dev/mapper/docker-8:3-61079671-9623cd0329b8e2a093cae0911ce6dabe515397391252ed410d6dd9b5c06da77f                     ext4    9.8G  1.8G  7.5G  20% /tmpfs                tmpfs    24G     0   24G   0% /devshm                  tmpfs    64M     0   64M   0% /dev/shm/dev/sda3ext4    1.1T  228G  800G  23% /etc/resolv.conf/dev/sda3ext4    1.1T  228G  800G  23% /etc/hostname/dev/sda3 ext4    1.1T  228G  800G  23% /etc/hosts[[email protected] ~]#

When the data space of a container is greater than 10GB, the container will not be able to write to the new data file. If the container requires a large amount of data space, you can use the data volume to hang on to the host or storage. When the container is too much using the data volume mount method, all containers are using more than 100GB of data space, then the container cannot be created or run. How to break through this limitation, this article gives the answer: Https://github.com/docker/docker/tree/master/daemon/graphdriver/devmapper
There are two kinds of situations to discuss:
1. If Docker is started for the first time, you can use the parameter –storage-opt to specify Dm.basesize, Dm.loopdatasize, Dm.loopmetadatasize, which specifies the available data space for a single container, the available data space for Docker, and the available data space for metadata. Take centos6.6 as an example (modify configuration file/etc/sysconfig/docker):

[[email protected] ~]# cat /etc/sysconfig/docker# /etc/sysconfig/docker## Other arguments to pass to the docker daemon process# These will be parsed by the sysv initscript and appended# to the arguments list passed to docker -dother_args="--storage-opt dm.basesize=20G --storage-opt dm.loopdatasize=200G --storage-opt dm.loopmetadatasize=4G -H tcp://127.0.0.1:2345 -H unix:///var/run/docker.sock"DOCKER_CERT_PATH=/etc/docker# Location used for temporary files, such as those created by# # docker load and build operations. Default is /var/lib/docker/tmp# # Can be overriden by setting the following environment variable.# # DOCKER_TMPDIR=/var/tmp[[email protected] ~]#

Specify a single container available data space 20GB, Docker available data space 200GB, metadata free space 4GB. Then start Docker and use Docker info to see that the configuration is in effect:

2. If you are running Docker, you need to export the image Docker commit, Docker push, Docker save, and then stop the Docker service and delete the Docker data file (centos6.6 is rm-rf/var/ lib/docker/). Re-modify the Docker configuration file/etc/sysconfig/docker and restart the Docker service to take effect. Finally import the mirrored boot container for the backup.
Article Source: http://www.xiaomastack.com/2015/06/05/docker-storage/

Docker Storage Settings

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.