Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spherex-dev/docker-backup-volume
Tooling to backup docker volumes
https://github.com/spherex-dev/docker-backup-volume
Last synced: 10 days ago
JSON representation
Tooling to backup docker volumes
- Host: GitHub
- URL: https://github.com/spherex-dev/docker-backup-volume
- Owner: spherex-dev
- Created: 2021-12-18T15:06:33.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-06-19T13:39:47.000Z (over 2 years ago)
- Last Synced: 2024-07-09T00:08:57.205Z (4 months ago)
- Language: Shell
- Size: 360 KB
- Stars: 47
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Backing up your docker volumes
## How to backup your volume
`backup-volume.sh` will create a new running docker container and mount the volume to the container. A `docker cp` will be run and the contents of the volume will be saved into a location determined by:
$prefix/$volume/_$volume.tar.gz
An example to run the command is the following:
backup-volume.sh -v -p
## Restoring your docker volume
Volumes can be restored using `create-volume-from-backup.sh` by invoking it in the following manner:
create-volume-from-backup.sh -v -p
Optionally if you wish to create a volume with a different name from the backup the script can be invoked in the following manner:
create-volume-from-backup.sh -v -p -n
## Execution Example
The animation below illustrates how the docker volume `owncloud-docker_files` is saved to `/tmp/backups/owncloud-docker_files`. The volume is saved as a zipped tar file with the date and time it was saved.
![](./images/create-volume-backup.gif)
The following animation shows how the docker volume is restored from `/tmp/backups` by specifying the snapshot file to restore fom. Note: If you wish to restore the docker volume with a different name than the backup, this can be done by adding a `-n` flag to the command and specifying the new volume name.
![](./images/restore-docker-volume.gif)
### Created by www.spherex.dev
We hope this code is useful for you.