Docker Community Forums

Share and learn in the Docker community.

Question: How to set the container rootfs size with devicemapper

Hi
I have encoutered a problem when I try to limit the size of a container.

I have followed the steps below to setup the storage driver:
Use the Device Mapper storage driver | Docker Documentation

after that, When I try to create a container with:

docker run -it --storage-opt size=120G fedora /bin/bash

which is shown in docker run | Docker Documentation , I got the following message:

docker: Error response from daemon: Failed to grow rootfs:exit status 1:xfs_growfs: /dev/mapper/docker-259:3-6685265-b340312c72ee1774ce026775a09e3331a276bbc9be43cd085b55a183ab042c83-init is not a mounted XFS filesystem.

My understanding is that I can do this as long as my storage driver is devicemapper.
Here are some infomation which may be related:

Client:
 Debug Mode: false

Server:
 Containers: 5
  Running: 0
  Paused: 0
  Stopped: 5
 Images: 3
 Server Version: 19.03.8
 Storage Driver: devicemapper
  Pool Name: docker-thinpool
  Pool Blocksize: 524.3kB
  Base Device Size: 10.74GB
  Backing Filesystem: xfs
  Udev Sync Supported: true
  Data Space Used: 11.02GB
  Data Space Total: 289.2GB
  Data Space Available: 278.2GB
  Metadata Space Used: 17.97MB
  Metadata Space Total: 3.041GB
  Metadata Space Available: 3.023GB
  Thin Pool Minimum Free Space: 28.92GB
  Deferred Removal Enabled: true
  Deferred Deletion Enabled: true
  Deferred Deleted Device Count: 2
  Library Version: 1.02.155 (2018-12-18)
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2c90293f6964528176db4fc61d3defe7ee281779
 runc version: 1.0.0~rc6+dfsg1-3
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.10.29-amd64-desktop
 Operating System: Deepin 20.2.1
 OSType: linux
 Architecture: x86_64
 CPUs: 16
# lvs
File descriptor 21 (anon_inode:[eventpoll]) leaked on lvs invocation. Parent PID 3379: bash
File descriptor 22 (pipe:[59397]) leaked on lvs invocation. Parent PID 3379: bash
File descriptor 23 (pipe:[59397]) leaked on lvs invocation. Parent PID 3379: bash
  LV       VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  thinpool docker twi-aot--- 269.38g             3.81   0.59 
# lsblk
NAME                                                                                               MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                                                                                                7:0    0  99.4M  1 loop /snap/core/11187
loop1                                                                                                7:1    0 470.7M  1 loop /snap/redis-desktop-manager/546
loop2                                                                                                7:2    0  99.4M  1 loop /snap/core/11420
loop3                                                                                                7:3    0 164.8M  1 loop /snap/gnome-3-28-1804/161
loop4                                                                                                7:4    0  55.5M  1 loop /snap/core18/2074
loop5                                                                                                7:5    0  99.4M  1 loop /snap/core/11316
loop6                                                                                                7:6    0  65.1M  1 loop /snap/gtk-common-themes/1515
loop7                                                                                                7:7    0 140.7M  1 loop /snap/mathpix-snipping-tool/195
sda                                                                                                  8:0    0 931.5G  0 disk 
├─sda1                                                                                               8:1    0 181.5G  0 part 
│ └─docker-thinpool_tdata                                                                          253:1    0 269.4G  0 lvm  
│   └─docker-thinpool                                                                              253:2    0 269.4G  0 lvm  
│     ├─docker-259:3-6685265-28e8173b2c6fedc3a0e98166c578d1850084483d9410fd6c865345b3afa1b88b      253:3    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-da2177a192295e5f803ea67ebb6a29f262fcb3c3b6e2ce0f9fd3183425c9f951-init 253:4    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-da2177a192295e5f803ea67ebb6a29f262fcb3c3b6e2ce0f9fd3183425c9f951      253:5    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-e25c18d34633888668ac1e9e1dfba7e2608e51fb026451ad1bd4da063334d7f8      253:6    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-615bce713a738a07ae14fd2697429d6ec6c9d85aea08e16b1ee98cdece3ca42a-init 253:7    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-615bce713a738a07ae14fd2697429d6ec6c9d85aea08e16b1ee98cdece3ca42a      253:8    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-b6185b455b4a356b1ae52b3b8364de6d0af39efe6f3e52c9d2c04108f61ce5cf      253:9    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-257e16ba61a0119ab43999905dfcb61d52f1c536c372ea8436fa82124bba2a30-init 253:10   0    15G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-159dacafbee311cf4f94ad79a0b6a8b3b8f768dad37b6f5a2ff1300986b5a2ca-init 253:11   0    15G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-d27a741826a21990ed89c2f364db5ee86cf89001e1ef3729958c122fab8ca8d9-init 253:12   0    20G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-c559c6d6b67939716c0a2c5668144f4424b4546dda44d1a1541deef0d6eb5150-init 253:13   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-b9ad2bf7f4ed42d2e2ee2c56dee6f0a83bb3b8fbce9549a4e7a2f886a3915b2f-init 253:14   0    20G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-77ef40eae3fd84ccdf274870cc76fb196f6057bb9df30cd58c15c30b8e61a4c0-init 253:15   0   120G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-c41ef71910ee6ef1ff75918d08fc44ffe06cec1f0578519ed68c1e7caa324b91-init 253:16   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-8c23dc242dab99289e1099b3543fbecdfc837b56d7a55a2f009f2fac01b2933d-init 253:17   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-52a45ea40af90046ed63bcf986db8b9e94acc76b598dda91846a0e13856963ae-init 253:18   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     └─docker-259:3-6685265-b340312c72ee1774ce026775a09e3331a276bbc9be43cd085b55a183ab042c83-init 253:19   0   120G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
└─sda3                                                                                               8:3    0   750G  0 part /home
nvme0n1                                                                                            259:0    0 238.5G  0 disk 
├─nvme0n1p1                                                                                        259:1    0   150M  0 part /boot/efi
├─nvme0n1p2                                                                                        259:2    0 102.1G  0 part 
│ ├─docker-thinpool_tmeta                                                                          253:0    0   2.9G  0 lvm  
│ │ └─docker-thinpool                                                                              253:2    0 269.4G  0 lvm  
│ │   ├─docker-259:3-6685265-28e8173b2c6fedc3a0e98166c578d1850084483d9410fd6c865345b3afa1b88b      253:3    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-da2177a192295e5f803ea67ebb6a29f262fcb3c3b6e2ce0f9fd3183425c9f951-init 253:4    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-da2177a192295e5f803ea67ebb6a29f262fcb3c3b6e2ce0f9fd3183425c9f951      253:5    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-e25c18d34633888668ac1e9e1dfba7e2608e51fb026451ad1bd4da063334d7f8      253:6    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-615bce713a738a07ae14fd2697429d6ec6c9d85aea08e16b1ee98cdece3ca42a-init 253:7    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-615bce713a738a07ae14fd2697429d6ec6c9d85aea08e16b1ee98cdece3ca42a      253:8    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-b6185b455b4a356b1ae52b3b8364de6d0af39efe6f3e52c9d2c04108f61ce5cf      253:9    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-257e16ba61a0119ab43999905dfcb61d52f1c536c372ea8436fa82124bba2a30-init 253:10   0    15G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-159dacafbee311cf4f94ad79a0b6a8b3b8f768dad37b6f5a2ff1300986b5a2ca-init 253:11   0    15G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-d27a741826a21990ed89c2f364db5ee86cf89001e1ef3729958c122fab8ca8d9-init 253:12   0    20G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-c559c6d6b67939716c0a2c5668144f4424b4546dda44d1a1541deef0d6eb5150-init 253:13   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-b9ad2bf7f4ed42d2e2ee2c56dee6f0a83bb3b8fbce9549a4e7a2f886a3915b2f-init 253:14   0    20G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-77ef40eae3fd84ccdf274870cc76fb196f6057bb9df30cd58c15c30b8e61a4c0-init 253:15   0   120G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-c41ef71910ee6ef1ff75918d08fc44ffe06cec1f0578519ed68c1e7caa324b91-init 253:16   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-8c23dc242dab99289e1099b3543fbecdfc837b56d7a55a2f009f2fac01b2933d-init 253:17   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   ├─docker-259:3-6685265-52a45ea40af90046ed63bcf986db8b9e94acc76b598dda91846a0e13856963ae-init 253:18   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ │   └─docker-259:3-6685265-b340312c72ee1774ce026775a09e3331a276bbc9be43cd085b55a183ab042c83-init 253:19   0   120G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│ └─docker-thinpool_tdata                                                                          253:1    0 269.4G  0 lvm  
│   └─docker-thinpool                                                                              253:2    0 269.4G  0 lvm  
│     ├─docker-259:3-6685265-28e8173b2c6fedc3a0e98166c578d1850084483d9410fd6c865345b3afa1b88b      253:3    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-da2177a192295e5f803ea67ebb6a29f262fcb3c3b6e2ce0f9fd3183425c9f951-init 253:4    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-da2177a192295e5f803ea67ebb6a29f262fcb3c3b6e2ce0f9fd3183425c9f951      253:5    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-e25c18d34633888668ac1e9e1dfba7e2608e51fb026451ad1bd4da063334d7f8      253:6    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-615bce713a738a07ae14fd2697429d6ec6c9d85aea08e16b1ee98cdece3ca42a-init 253:7    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-615bce713a738a07ae14fd2697429d6ec6c9d85aea08e16b1ee98cdece3ca42a      253:8    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-b6185b455b4a356b1ae52b3b8364de6d0af39efe6f3e52c9d2c04108f61ce5cf      253:9    0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-257e16ba61a0119ab43999905dfcb61d52f1c536c372ea8436fa82124bba2a30-init 253:10   0    15G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-159dacafbee311cf4f94ad79a0b6a8b3b8f768dad37b6f5a2ff1300986b5a2ca-init 253:11   0    15G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-d27a741826a21990ed89c2f364db5ee86cf89001e1ef3729958c122fab8ca8d9-init 253:12   0    20G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-c559c6d6b67939716c0a2c5668144f4424b4546dda44d1a1541deef0d6eb5150-init 253:13   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-b9ad2bf7f4ed42d2e2ee2c56dee6f0a83bb3b8fbce9549a4e7a2f886a3915b2f-init 253:14   0    20G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-77ef40eae3fd84ccdf274870cc76fb196f6057bb9df30cd58c15c30b8e61a4c0-init 253:15   0   120G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-c41ef71910ee6ef1ff75918d08fc44ffe06cec1f0578519ed68c1e7caa324b91-init 253:16   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-8c23dc242dab99289e1099b3543fbecdfc837b56d7a55a2f009f2fac01b2933d-init 253:17   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     ├─docker-259:3-6685265-52a45ea40af90046ed63bcf986db8b9e94acc76b598dda91846a0e13856963ae-init 253:18   0    10G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
│     └─docker-259:3-6685265-b340312c72ee1774ce026775a09e3331a276bbc9be43cd085b55a183ab042c83-init 253:19   0   120G  0 dm   /media/penguincat/253c3f44-077e-43ca-9bed-44ebf
└─nvme0n1p7    
#pvs
File descriptor 21 (anon_inode:[eventpoll]) leaked on pvs invocation. Parent PID 3379: bash
File descriptor 22 (pipe:[59397]) leaked on pvs invocation. Parent PID 3379: bash
File descriptor 23 (pipe:[59397]) leaked on pvs invocation. Parent PID 3379: bash
  PV             VG     Fmt  Attr PSize    PFree 
  /dev/nvme0n1p2 docker lvm2 a--   102.05g <8.52g
  /dev/sda1      docker lvm2 a--  <181.51g     0 
#vgs
File descriptor 21 (anon_inode:[eventpoll]) leaked on vgs invocation. Parent PID 3379: bash
File descriptor 22 (pipe:[59397]) leaked on vgs invocation. Parent PID 3379: bash
File descriptor 23 (pipe:[59397]) leaked on vgs invocation. Parent PID 3379: bash
  VG     #PV #LV #SN Attr   VSize   VFree 
  docker   2   1   0 wz--n- 283.56g <8.52g