| Crates.io | rdbkp2 |
| lib.rs | rdbkp2 |
| version | 2.1.7 |
| created_at | 2025-02-27 06:29:19.358692+00 |
| updated_at | 2025-11-21 10:08:15.114411+00 |
| description | A CLI tool for backing up and restoring Docker container data |
| homepage | https://github.com/yuniqueunic/rdbkp2 |
| repository | https://github.com/yuniqueunic/rdbkp2 |
| max_upload_size | |
| id | 1571388 |
| size | 294,828 |
A command-line tool for backing up and restoring Docker container data.
Ensure you have the Rust toolchain installed on your system, then execute:
# Install rdbkp2
cargo install rdbkp2
# Create symbolic link to enable sudo rdbkp2 ... usage
# sudo ln -s $(where rdbkp2) /usr/local/bin/rdbkp2 # Create a symbolic link for rdbkp2 to /usr/local/bin/rdbkp2 to enable sudo rdbkp2 ... usage
rdbkp2 link install # Use this command to replace manual symbolic link creation above
# Check for updates
rdbkp2 update
# Uninstall rdbkp2
rdbkp2 uninstall
rdbkp2 list
[!TIP] The default backup directory is selected based on the following priority:
- $APPDATA/rdbkp2 (Windows) or ~/.local/share/rdbkp2 (Unix)
- $HOME/rdbkp2
- ./rdbkp2 (current directory)
Interactive Mode:
rdbkp2 backup -i
Command-line Mode:
rdbkp2 backup -c container_name -o /path/to/backup/dir
Interactive Mode:
rdbkp2 restore -i
Command-line Mode:
rdbkp2 restore -c container_name -f /path/to/backup/file
rdbkp2 link install # create the symbol-link at /usr/local/bin/rdbkp2
rdbkp2 link uninstall # remove the symbol-link at /usr/local/bin/rdbkp2
Generate command-line completion scripts for various shells:
# Generate Bash completion script
rdbkp2 completions bash > ~/.local/share/bash-completion/completions/rdbkp2
# Generate Zsh completion script
rdbkp2 completions zsh > ~/.zsh/_rdbkp2
# Generate Fish completion script
rdbkp2 completions fish > ~/.config/fish/completions/rdbkp2.fish
# Generate PowerShell completion script
# Windows PowerShell
mkdir -p $PROFILE\..\Completions
rdbkp2 completions powershell > $PROFILE\..\Completions\rdbkp2.ps1
Add the following lines to your ~/.bashrc or ~/.bash_profile:
source ~/.local/share/bash-completion/completions/rdbkp2
After placing the completion script in the correct location, ensure completion is enabled in your ~/.zshrc:
autoload -Uz compinit
compinit
Fish shell automatically loads completion scripts from the ~/.config/fish/completions directory. No additional configuration is needed.
Add the following line to your PowerShell profile:
. $PROFILE\..\Completions\rdbkp2.ps1
| Argument | Description | Default Value |
|---|---|---|
-y, --yes |
Automatic confirmation prompt | false |
-i, --interactive |
Use interactive mode | true |
-v, --verbose |
Display detailed logs | false |
-t, --timeout |
Container stop timeout (seconds) | 30 |
-e, --exclude |
Exclusion patterns | ".git,node_modules,target" |
-r, --restart |
Restart container after operation | false |
-l, --lang |
Language (zh-CN/en/ja/ko/es/fr/de/it) | zh-CN |
backup)| Argument | Description |
|---|---|
-c, --container |
Container name or ID |
-f, --file |
Path to file(s) or directory(s) to back up |
-o, --output |
Output directory |
| Inherited from common arguments | |
-y, --yes |
Automatic confirmation prompt |
-i, --interactive |
Use interactive mode |
-r, --restart |
Restart the container after operation |
-t, --timeout |
Timeout for stopping the container (seconds) |
-e, --exclude |
Exclusion patterns |
-l, --lang |
Language (zh-CN/en/ja/ko/es/fr/de/it) |
restore)[!CAUTION] π Caution: Restoring Docker container bound volumes requires Administrator privileges.
β Please run [program] assudo/Run as Administrator.
| Argument | Description |
|---|---|
-c, --container |
Container name or ID |
-f, --file |
Path to backup file (compressed archive) |
-o, --output |
Output directory |
| Inherited from common arguments | |
-y, --yes |
Automatic confirmation prompt |
-i, --interactive |
Use interactive mode |
-r, --restart |
Restart container after operation |
-t, --timeout |
Container stop timeout (seconds) |
-e, --exclude |
|
-l, --lang |
Language (zh-CN/en/ja/ko/es/fr/de/it) |
list)No arguments. Displays all available containers.
completions)shell: Specifies the shell type (bash/zsh/fish/powershell)Link install/uninstall)[!CAUTION] π Caution: Install soft-symbol-link requires Administrator privileges.
| Argument | Description |
|---|---|
| Inherited from common arguments | |
-y, --yes |
Automatic confirmation prompt |
-l, --lang |
Language (zh-CN/en/ja/ko/es/fr/de/it) |
sudo / Administrator privileges.
docker stop, so already-stopped containers no longer cause silent failures.bollard::query_parameters API so builds stay warning-free and aligned with upstream changes.| Library Name | Version | Purpose Description | Link |
|---|---|---|---|
| clap | 4.5.1 | CLI argument parsing and construction | Crates.io |
| dialoguer | 0.11.0 | CLI interactive dialogue tool | Crates.io |
| bollard | 0.18 | Docker API client (supports SSL) | Crates.io |
| toml | 0.8.10 | TOML format configuration file parsing | Crates.io |
| serde | 1.0 | Data serialization/deserialization (with derive support) | Crates.io |
| tar | 0.4.40 | TAR compression/decompression | Crates.io |
| xz2 | 0.1.7 | XZ compression/decompression | Crates.io |
| anyhow | 1.0.80 | Error handling and propagation | Crates.io |
| thiserror | 2 | Custom error type definition | Crates.io |
| tokio | 1.44 | Asynchronous runtime (with full features) | Crates.io |
| tracing | 0.1.40 | Log tracing system | Crates.io |
| tracing-subscriber | 0.3.18 | Log subscription and formatting (with environment filtering) | Crates.io |
| walkdir | 2.4.0 | File system traversal | Crates.io |
| chrono | 0.4.34 | Date and time handling | Crates.io |
| tempfile | 3.18 | Temporary file operations | Crates.io |
| fs_extra | 1.3.0 | File system extended operations | Crates.io |
| dunce | 1.0.5 | File path normalization | Crates.io |
| mockall | 0.13.1 | Unit test mocking tool | Crates.io |
| privilege | 0.3.0 | Privilege management (for Windows privilege elevation) | Crates.io |
| dirs | 6.0.0 | System directory path retrieval | Crates.io |
| semver | 1.0 | Semantic version parsing | Crates.io |
| reqwest | 0.12 | HTTP request client (with JSON support) | Crates.io |
| rust-i18n | 3.1.3 | Internationalization and localization support | Crates.io |
| runas | 1.2.0 | Windows command execution with elevated privileges (Windows-only) | Crates.io |
Platform-Specific Dependencies:
runas is Windows-only; other libraries are cross-platform (Linux/macOS/Windows).Performance Optimization:
strip = true: Removes debug symbols in release builds to reduce binary size.lto = "thin" and opt-level = 3: Enables Link-Time Optimization (LTO) and maximum optimization level.Acknowledgements:
Special thanks to these open-source projects for providing foundational support to rdbkp2!