Backup docker volumes directly from host

I’m running docker on an ubuntu 18.04 server. I’m running several containers with some of them having data volumes.
Is it possible to create a filebased backup of those volumes with a backup-client (urbackup) directly on the host?

Yes you can, after all, all the container mount points are available on the host.

There’s one catch : they are not always available at the same exact path. So it’s going to be possible only if the backup path can be configured dynamicly.

A simple example :

$ docker run --rm -d php:7.1-fpm-alpine
$ docker ps
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS               NAMES
00cd8de8203d        php:7.1-fpm-alpine   "docker-php-entrypoi…"   5 minutes ago       Up 5 minutes        9000/tcp            tender_mahavira
$ docker inspect 00cd8de8203d|awk '$1~/MergedDir/{print $2}'|sed 's/^"//;s/",$//'
/var/lib/docker/overlay2/b71a1504e2fb84de96f96e35cb1f5f7d8c6ac3380416360d156955893538b337/merged

This is a way to find the mount point of the root filesystem. Backup the data from there and you have what you want.
You probably want to write a little script that will create a symlink based on the previous commands so the backup directory is constant.
Then use the prescript feature of urbackup : https://www.urbackup.org/administration_manual.html#x1-330006.4

Disclaimer : never tested here :stuck_out_tongue: