BretFisher/docker-vackup
소개
Docker 볼륨을 쉽게 백업하고 복원하는 스크립트
시스템 및 인프라측정된 스타 증가
- in 24h
- +1
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalVackup: Backup and Restore Docker Volumes
This is now built into Docker Desktop's Dashboard UI (Volumes Tab) which has more features, but I'll keep this tool around for those not using Docker Desktop.
Vackup: (contraction of "volume backup")
Easily backup and restore Docker volumes using either tarballs or container images. It's designed for running from any host/container where you have the Docker CLI.
Note that for open files like databases, it's usually better to use their preferred backup tool to create a backup file, but if you stored that file on a Docker volume, this could still be a way you get the Docker volume into an image or tarball for moving to remote storage for safe keeping.
export/import commands copy files between a local tarball and a volume.
For making volume backups and restores.
save/load commands copy files between an image and a volume.
For when you want to use image registries as a way to push/pull volume data.
Usage:
vackup export [OPTIONS] VOLUME FILE
Creates a gzip'ed tarball in current directory from a volume
--owner=UID[:GID]Change the ownership of the exported archive on Linux (won't have any effect on macOS)
vackup import FILE VOLUME
Extracts a gzip'ed tarball into a volume
vackup save VOLUME IMAGE
Copies the volume contents to a busybox image in the /volume-data directory
vackup load IMAGE VOLUME
Copies /volume-data contents from an image to a volume
Install
Download the vackup file in this repository to your local machine in your shell path and make it executable.
sudo curl -sSL https://raw.githubusercontent.com/BretFisher/docker-vackup/main/vackup -o /usr/local/bin/vackup && sudo chmod +x /usr/local/bin/vackup
Testing
Vackup includes a comprehensive test suite using Bats (Bash Automated Testing System) that ensures compatibility across macOS, Linux, and Windows WSL.
Run Tests Locally
# Install Bats first
# macOS: brew install bats-core
# Ubuntu/Debian: apt-get install bats
# Run all tests
./test/run-tests.sh
# Run with verbose output
./test/run-tests.sh -v
# Clean up test resources first
./test/run-tests.sh -c
Test Coverage
- All four commands (
export,import,save,load) - Error handling and edge cases
- Cross-platform compatibility
- Data integrity and round-trip consistency
- Files with special characters and complex directory structures
See test/README.md for detailed testing documentation.
Error conditions
If any of the commands fail, the script will check to see if a VACKUP_FAILURE_SCRIPT
environment variable is set. If so it will run it and pass the line number the error
happened on and the exit code from the failed command. Eg,
# /opt/bin/vackup-failed.sh
LINE_NUMBER=$1
EXIT_CODE=$2
send_slack_webhook "Vackup failed on line number ${LINE_NUMBER} with exit code ${EXIT_CODE}!"
export VACKUP_FAILURE_SCRIPT=/opt/bin/vackup-failed.sh
./vackup export ......
관련 프로젝트 살펴보기
불러오는 중…