# Storage engines and startup options =================================== This is an advanced option, see / for details. You can omit this and use the default storage engine for now. Note: the default storage driver for Linux is "Device Mapper". The default settings have very poor performance and is highly recommended to use a different driver or to configure Device Mapper to use a dedicated partition. The 2 options I recommend are \* overlay2 -- requires Linux kernal 4.0+ \* devicemapper properly configured The devicemapper configuration process is failry involved but worth the effort if dont want to or cant use the overlay2 driver. ### Directions on using devicemapper https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/ An example using devicemapper properly configured: /usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt=dm.use\_deferred\_removal=true --storage-opt=dm.use\_deferred\_deletion=true --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=generic --bip=10.250.0.1/16 ### Directions for overlay2 https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/ Hints: This process will appear to lose your containers and images, but they are perfectly safe. Docker uses different directories per storage driver /var/lib/docker/ If you are running devicemapper you will have /var/lib/docker/devicemapper This directory will not be touched by changing storage drivers. To get back you simply need to revert the --storeage-driver flag change. The references have directions on how to copy your containers and images if you need to. Its easier and much faster if you can rebuild new containers and pull new images, but you can copy all of your current containers and images. ### Check your current device driver test for overlay driver installed lsmod | grep overlay If this does not return "overlay" then you need to configure the kernal to load the overlay driver on boot. https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/ https://adminswerk.de/overlayfs-docker-storage-driver-centos-7/ For a 1 thime test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ modprobe overlay ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To have it loaded on boot echo "overlay" \> /etc/modules-load.d/overlay.conf When complete, reboot and test using docker info It should read something like this: ``` $ docker info Containers: 5 Running: 0 Paused: 0 Stopped: 5 Images: 140 Server Version: 1.12.6 Storage Driver: overlay2 Backing Filesystem: xfs Logging Driver: json-file Cgroup Driver: cgroupf .... ``` The "Storage Driver" value should be 'overlay2' Extras ------ Docker makes use of a variety of advanced filesysytem features including logical volumes, bind mounts, sparse files. Over time it can accumulate to a large size. It’s a good idea to dedicate a volume and filesystem just for docker at /var/lib/docker –reguardless of what storage engine you use. Its best if volume is on your faster drives, and in case of problems doesn’t corrupt the rest of your system. Don’t run docker on a network mounted filesystem if you can help it. Running on VM’s, if possible use local/persistent storage or ‘thick’ provisioned volumes.