Created
April 2, 2023 17:26
-
-
Save Jacobboogiebear/ffc407a6af2c7d2a02c3c7603b13f67c to your computer and use it in GitHub Desktop.
Batch scripts to optimize Docker Desktop storage on Windows 10/11 (requires Hyper-V enabled, for Windows 11 home use this script to enable: https://gist.github.com/Jacobboogiebear/24b46aa0c5587db50673403c4117a5bf)
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
@echo off | |
set "params=%*" | |
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B ) | |
taskkill /F /IM "Docker Desktop.exe" /T | |
wsl --shutdown | |
powershell -Command "Optimize-VHD -Path %LOCALAPPDATA%\\Docker\\wsl\\data\\ext4.vhdx" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment