I need to backup a docker volume to a specific directory within another docker volume using Duplicity. So I need to run a command like this within the container performing the backup:
mkdir -p /backup/$backup-label
duplicity /target file:///backup/$backup-label
So I have created a docker image containing duplicity so I can run the above command with mapping the volume to be backed up to /target
and the volume that stores the backup to /backup
.
So my question is how to I pass $backup-label to the run
command and how do I create the Entrypoint so that it makes sure that the correct directory structure exists prior to running duplicity as indicated above?
TIA, Ole
P.S. If I could run the container like this:
ole@MKI:~$ docker run --rm -it -v data-volume:/target -v backup-volume/label-for-backup:/backup duplicity-backup-image
That would solve it. But apparently docker does not allow the mapping of subdirectories within volumes. When I try I get the following message:
docker: Error response from daemon: create backup-volume/label-for-backup: "backup-volume/label-for-backup" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed.