Last active
February 16, 2025 01:58
-
-
Save nero-dv/b63b5e555541a4273c422e9c1b242482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$envFilePath = ".env" | |
Get-Content $envFilePath | ForEach-Object { | |
$vol = $_ | |
Set-Variable -Name vol -Value $_ -Scope Global | |
docker run --rm --quiet --volume ${vol}:/backupdata --volume .\exported:/to_export busybox tar czf /to_export/${vol}.tar.gz /backupdata | |
if ($?) { | |
Write-Host "Backup of $vol completed successfully." | |
} | |
} | |
$del = Read-Host "Delete volume created during export? (y/n)" | |
if ($del -eq "y") { | |
docker volume rm exported | |
Write-Host "Volume 'exported' has been deleted." | |
} | |
else { | |
Write-Host "Volume 'exported' has not been deleted." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment