7

I recently heard (from a RedHat guy) that "direct-LVM"(devicemapper) is the recommended storage-backend for production setups, so I wanted to try that out on a CentOS 7 VM. (where loopback-LVM seems to be the default).

So I created a separate data-disk and VG with 2 LVs for data and metadata, passed them into the docker config and started up docker ... so far so good, looks like this:

# ps auxwf
...
/usr/bin/docker -d --selinux-enabled -H unix://var/run/docker.sock \
                --log-level=warn --storage-opt dm.fs=xfs \
                --storage-opt dm.datadev=/dev/vg_data/docker-data \
                --storage-opt dm.metadatadev=/dev/vg_data/docker-meta \
                --storage-opt dm.basesize=30G --bip=172.17.42.1/24 \

# docker info
Containers: 8
Images: 145
Storage Driver: devicemapper
 Pool Name: docker-253:0-34485692-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: xfs
 Data file: /dev/vg_data/docker-data
 Metadata file: /dev/vg_data/docker-meta
 Data Space Used: 4.498 GB
 Data Space Total: 34.36 GB
 Data Space Available: 29.86 GB
 Metadata Space Used: 6.402 MB
 Metadata Space Total: 104.9 MB
 Metadata Space Available: 98.46 MB
 ...
 ...

But today when I started a container that generates pretty much of local data (since I don't need to persist that for testing, I haven't mapped that Volumes anywhere on startup) , I noticed, that Volume-Data is all put into /var/lib/docker/vfs directories instead of the LVM thinpool as I expected.

This is in fact filling up my root-fs that I kept small by intent.

This is the Disk-Layout as seen by the Docker-Host:

# lsblk
NAME                             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                                8:0    0   10G  0 disk 
+-sda1                             8:1    0  500M  0 part /boot
+-sda2                             8:2    0  9.5G  0 part 
  +-centos_system-root           253:0    0  8.5G  0 lvm  /
  +-centos_system-swap           253:1    0    1G  0 lvm  [SWAP]
sdb                                8:16   0   50G  0 disk 
+-vg_data-docker--data           253:2    0   32G  0 lvm  
| +-docker-253:0-34485692-pool   253:4    0   32G  0 dm   
|   +-docker-253:0-34485692-...  253:5    0   30G  0 dm   
|   +-docker-253:0-34485692-...  253:6    0   30G  0 dm   
+-vg_data-docker--meta           253:3    0  100M  0 lvm  
  +-docker-253:0-34485692-pool   253:4    0   32G  0 dm   
    +-docker-253:0-34485692-...  253:5    0   30G  0 dm   
    +-docker-253:0-34485692-...  253:6    0   30G  0 dm   

How can I get Docker to put Volumes (either implicitly created or explicit in Data-containers) to be put onto the configured storage-backend ?

Or will this really only be used for (base-)images and my expectations have been totally wrong ?

powo
  • 460
  • 1
  • 6
  • 17
  • 1
    This great article answered my questions: http://container-solutions.com/2014/12/understanding-volumes-docker/ ... so I was actually wrong with my assumptions – powo May 13 '15 at 17:57

1 Answers1

0

You need to specify a mountpoint like "-g /docker".

StefanLe
  • 11
  • 3