Duplicity tool with PyDrive2 To Backup/Restore From Google Drive
841
This repository builds a docker image containing the duplicity backup tool in combination with the PyDrive2 libraries. The container is intended for performing backups to and from Google Drive.
The following command is used to run the container and execute duplicity commands as the root user:
docker run -it --rm \
-e GOOGLE_DRIVE_SETTINGS=/config/pydrive.conf \
-e PASSPHRASE=<ENCRYPTION PHRASE> \
-v <DATA TO BACKUP>:/data:ro \
-v ${PWD}/config:/config \
-v ${PWD}/cache:/root/.cache/duplicity \
-v ${PWD}/gnupg:/root/.gnupg \
-u 0 \
geoffh1977/duplicity
Duplicity is set as the Entrypoint of the container, so commands can be executed without specifying the duplicity command on the command line.
It is also important to note this command will run the container as the root user. This is used for large data backups on servers containing user/group ids from multiple users.
N.B. The data path is only required when an actual backup is being performed. Other commands (i.e. collection-status for example) do not need the data path mapped.
If the data being backed up is all located under a single user/group id, the container can be run as a normal user with the following command (UID is set to 1000):
docker run -it --rm \
-e GOOGLE_DRIVE_SETTINGS=/config/pydrive.conf \
-e PASSPHRASE=<ENCRYPTION PHRASE> \
-v <DATA TO BACKUP>:/data:ro \
-v ${PWD}/config:/config \
-v ${PWD}/cache:/home/user/.cache/duplicity \
-v ${PWD}/gnupg:/home/user/.gnupg \
geoffh1977/duplicity
The image needs 2 configuration files to run correctly. One is the pydrive config while the other is a cache of where to store credentials generated by OAuth.
client_config_backend: settings
client_config:
client_id: <CLIENT ID FROM GOOGLE DEVELOPER CONSOLE>
client_secret: <CLIENT SECRET FROM GOOGLE DEVELOPER CONSOLE>
save_credentials: True
save_credentials_backend: file
save_credentials_file: /config/cache.json
get_refresh_token: True
The cache file in the pydrive config file will be created on the first connection to the Google Drive. The user will need to visit a link presented by the duplicity application to create a valid OAuth connection via the browser.
Content type
Image
Digest
sha256:af01c36ca…
Size
59 MB
Last updated
almost 3 years ago
docker pull geoffh1977/duplicity