Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
fix: docker-wsl backup command
Browse files Browse the repository at this point in the history
  • Loading branch information
mriedmann committed Jan 31, 2023
1 parent 67200ec commit ed8e644
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions msi/scripts/docker-wsl-control.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Get-CalledName {
function Invoke-DockerEngineBackup {
Stop-Docker
Push-Location $LocalBase
& wsl -d "$DISTRONAME" -u root -- sh -c 'wsl-mount && tar -czpf backup.tar.gz /var/lib/docker'
& wsl -d "$DISTRONAME" -u root -- sh -c 'ONESHOT=1 wsl-mount && tar -czpf backup.tar.gz /var/lib/docker'
if($LASTEXITCODE -ne 0) {
Write-Warning "Backup of existing WSL distro '$DISTRONAME' failed!"
} else {
Expand All @@ -93,7 +93,7 @@ function Invoke-DockerEngineRestore {
Write-Host "Existing Docker backup found! Restoring ..."
Stop-Docker
Push-Location $LocalBase
& wsl -d "$DISTRONAME" -u root -- sh -c 'wsl-mount && cd / && tar -xpzf $(pwd)/backup.tar.gz -C /'
& wsl -d "$DISTRONAME" -u root -- sh -c 'ONESHOT=1 wsl-mount && cd / && tar -xpzf $(pwd)/backup.tar.gz -C /'
if($LASTEXITCODE -ne 0) {
Write-Warning "Restore Docker on WSL distro '$DISTRONAME' failed! Please inspect the backup-file at $LocalBase\backup.tar.gz and apply it manually to /var/lib/docker inside WSL"
}
Expand Down

0 comments on commit ed8e644

Please sign in to comment.