How to increase the space (Data Space Total) used by Docker ? That value is less than half on the disk size

Viewed 4288

Many times, I have this error when building Dockerfile :

devmapper: Thin Pool has 157168 free data blocks which is less than minimum required 163840 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior

My disk has at all 250Go and when I execute docker version, I can see in storage part :

Storage Driver: devicemapper
 Pool Name: docker-253:0-19468577-pool
 Pool Blocksize: 65.54kB
 Base Device Size: 21.47GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 97.03GB
 Data Space Total: 107.4GB
 Data Space Available: 10.35GB
 Metadata Space Used: 83.67MB
 Metadata Space Total: 2.147GB
 Metadata Space Available: 2.064GB
 Thin Pool Minimum Free Space: 10.74GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.135-RHEL7 (2016-11-16)

I tried after stopping docker service : I tried :

dockerd --storage-opt dm.thinpooldev dm.min_free_space=3%
dockerd --storage-opt  dm.thinp_autoextend_percent

But those command doesn't succed.

How to increase the Data Space Total (the free space on the disk is more than 2 times 107.4GB) ? Or How to decrease the Thin Pool Minimum Free Space: 10.74GB ?

2 Answers

If you've cleaned/pruned and still have issues this is how you actually modify the min space setting.

Create/Modify this file: /etc/docker/daemon.json

{
   "storage-opts": [
    "dm.min_free_space=1%"
    ]
}

DISCLAIMER: This answer does not address the specific question of the poster. However it may help or alleviate the problem to people that get the same error message.

This answer specifies the way to generally free space, not configuring the amount of space to be used.

Probably it's because of docker occupying its assigned space with containers, images or volumes. To see actual Docker's usage, run:

$ docker system df

TYPE                TOTAL               ACTIVE              SIZE             RECLAIMABLE
Images              135                 27                  41.33GB             33.77GB (81%)
Containers          34                  32                  509.4MB             15.21kB (0%)
Local Volumes       387                 3                   3.706GB             3.706GB (99%)

Prune helps with cleaning up:

$ docker system prune
WARNING! This will remove:
    - all stopped containers
    - all networks not used by at least one container
    - all dangling images
    - all build cache
Are you sure you want to continue? [y/N] y

(See alternatives in Prune page for older Docker versions).

Beware that volumes are not removed by default, to prevent loss of data. You'd have to specify it yourself, adding --volumes or cleaning them manually.

Related