How to tell Docker to use dm/LVM backend for volumes instead of vfs

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:

  • Upgrade docker on CentOS 7
  • Creating/Running a docker container from within a c# program (under mono)
  • Not able to start Docker daemon
  • CentOS 7.0 docker fail to start service
  • No Space on CentOS with Docker
  • Docker exec rpc error code =13 desc = invalid header field value “oci runtime error: exec failed: cannot exec a container that has run and stopped\n”
  • # 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= \
    # 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 ?

  • docker interactive mode exits after ENTRYPOINT
  • What is for parser directive in docker
  • How to put docker image created through save command to remote registry without docker client
  • Elasticsearch Docker stop seems to ignore SIGKILL
  • How to use volume in docker compose for postgres?
  • Monitor Docker container with Zabbix
  • One Solution collect form web for “How to tell Docker to use dm/LVM backend for volumes instead of vfs”

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

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.