Docker Volume backup best practices

Greetings,

I’m having trouble understanding best practices for backing up Docker data volumes. Am I on the right track with what I’ve done below, or have I missed a method that would be much easier?

Issue Type: Trouble backing up docker data volume
Host OS Version/Build: Windows 10 Enterprise 10.0.14393
App Version: Docker Community Edition v17.06.2-ce-win27 (13194)

I’m currently running the bitnami MediaWiki stack using docker-compose up -d with the yaml config file below. It’s functioning perfectly and Docker made that process pleasingly simple.

The configuration uses volumes to store persistent data. However, I’m having trouble figuring out how to backup the volumes to cloud backup. To accomplish this I’d like to be able to generate a compressed volume and send that over to a onedrive backup. I’d eventually like to automate the process and add incremental backups, but right now I’m just trying to get full backups working with manual steps.

In my search I’ve come across the Docker documentation on volumes. Despite this Stack Overflow answer the Docker volume docs no longer appears to address backups. I’ve found and tried out some docker containers who’s purpose is to backup and restore volumes. I’ve had the following issues:

  1. Volumerize
    1. Duplicity appears to give an error wanting an extra argument
  2. volume-backup
    1. This doesn’t appear to do anything?
  3. Using Kitematic to Enable Volume and attempt to copy data using Windows 10 Host OS
    1. After doing this with both containers, the MediaWiki container is unable to find the SQL user on the MariaDB container. I’m not totally surprised by this, since the container OS is linux-based.

As you can see from my results, I’m not getting expected results from their tutorials. I think my issue is not using the Duplicity tool underlying both containers correctly. However, I’m not yet skilled enough with Docker to understand how to debug a container.

I’d really appreciate any guidance the community could provide.

MediaWiki docker-compose.yml:

version: '2'
services:
  mariadb:
    image: 'bitnami/mariadb:latest'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    volumes:
      - 'mariadb_data:/bitnami'
  mediawiki:
    image: 'bitnami/mediawiki:latest'
    labels:
      kompose.service.type: nodeport
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - 'mediawiki_data:/bitnami'
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  mediawiki_data:
    driver: local

If your Host OS is windows and say your volume is D:\xxx\mediawiki

One Option is to use softwares like

https://blog.bacula.org/
https://www.backup-utility.com/articles/free-nas-backup-4125.html
to Backup D:\xxx\mediawiki

and then use windows scheduler to encrypt the Backup and push it to Onedrive or just sync as in

–Siju

Thanks for the reply.

I new to Docker and don’t have the right vocabulary (yet) to describe the problem precisely, so apologies in advance. This sounds like my third option above and it appears not to be a viable solution when running linux containers with a Windows host.

It looks like there are two kinds of volumes in docker:

  • Volumes that are shared from a directory on the host OS

  • Volumes that are only seen using docker volume commands and are not mapped to the host OS filesystem.

The bitnami mediawiki container only works with the second type. If I use Enable Volumes from within Kitematic to store the volume on C:\xxx\mediawiki then the mediawiki container is unable to access the SQL database on the mariadb container. I strongly suspect this is due to differences between NTFS and Ext4 filesystems.

I’d like to try a backup/restore of where Docker stores docker-only volumes in the Windows 10 host filesystem?

Can anyone point me in the direction of where I can find that location so I can try?

You’d be better off using a storage driver [say NFS] to locate your data on network storage rather than on the host and then using whatever backup/restore approach you use there. If your host goes pop, no amount of carefully planned backup method will save you if you leave it on the host itself.

In the past I just copied the entire VM to backup folder simple but not really resources saving.
The architecture changed with the introduction of the new Docker for Windows.
What is the current recommended approach.
I found only this: Easy steps to backup and restore your Docker containers

as the design of virtualization changed with Windows 1709

I think the following is the right way how to backup