Search code examples
dockerbackupscpdocker-volume

Using Volumerize to backup my docker volumes with scp ?


I have a couple of docker volumes i want to backup onto another server, using scp/sftp. I don't know how to deal with that so i decided to have a look at blacklabelops/volumerize GitHub project.

This tool is based on the command line tool Duplicity. Dockerized and Parameterized for easier use and configuration. Tutorial is dealing with a jenkins docker, but i don't understand how to mention i'm want to use a pem file.

I've tried different solution (adding -i option to scp command line) without any success at the moment.

Duplicity man page is mentioning the use of cacert pem files (--ssl-cacert-file option), but i suppose i have to create an env variable when running the docker (with -e option), and i don't know which name to use.

Here what i have so far, can someone please point me in the right direction ?

docker run -d --name volumerize -v jenkins_volume:/source:ro -v backup_volume:/backup     -e "VOLUMERIZE_SOURCE=/source"  -e "VOLUMERIZE_TARGET=scp://me@serverip/home/backup" blacklabelops/volumerize

Solution

  • The option --ssl-cacert-file is only for host verification not for authentication.

    I have found this example on how to add pem files inside an scp command:

    scp -i /path/to/your/.pemkey -r /copy/from/path user@server:/copy/to/path
    

    The parameter -i /path/to/your/.pemkey can be passed in blacklabelops/volumerize with the env variable `VOLUMERIZE_DUPLICITY_OPTIONS``

    Example:

    $ docker run -d \
      --name volumerize \
      -v jenkins_volume:/source:ro \
      -v backup_volume:/backup \
      -e "VOLUMERIZE_SOURCE=/source" \
      -e "VOLUMERIZE_TARGET=scp:///backup" \
      -e 'VOLUMERIZE_DUPLICITY_OPTIONS=--ssh-options "-i /path/to/your/.pemkey"' \
    blacklabelops/volumerize