Docker Community Forums

Share and learn in the Docker community.

Docker - device-mapper direct-lvm

(Jairmenezes) #1

Hi, guys.

I’m using device-mapper driver with direct-lvm, I intend to change the docker root directory from “/var/lib/docker” to another mount point, is there any advantage in this or how
good practice should I keep in "/var/lib/docker?

Thanks in advance,

Jair Menezes

(Tnelis) #2

Your layer graph will already be in different LVM volumes. By moving the Docker root directory, you’re moving the rest (light resource definitions like Docker networks, and the more heavyweight Docker volumes backed by the local host driver).

Notice: Usually if you need to cater for specific requirements regarding /var/lib/docker, it’s only for the local Docker volumes.

Honestly if you can mount /var/lib/docker (or just /var/lib/docker/volumes) on your desired block device, it’s probably better than adding another level of indirection with the Docker directory configuration to use another mountpoint at a possibly obscure location. Whether you consider that advice “best practice” or not is up to you.

For the record: We’ve tested mounting /var/lib/docker/volumes on a different filesystem than /var/lib/docker and it works great. We’ve also tested symlinking it to another mountpoint; this works in practice except for volume removals (you have to remove the volume directories manually). We have not extensively tested relocating the whole Docker directory to another mountpoint via configuration, but there’s no reason it wouldn’t work just fine (same with simply mounting the whole /var/lib/docker directory elsewhere, as explained above).