Backup and Restore of Docker Desktop for Windows #5479
FlattusBlastus
started this conversation in
Wiki
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This method of performing backup and restore functions treats virtual machines as they are rather than attempting to do them from within the virtual environment as if the machines were physical. This procedure does not use client / server software or Volume Shadow Copy Service (VSS).
The upsides to this procedure are:
Fastest backup method
Least amount of downtime
Backup all docker containers, volumes, and docker container settings
Free
The downsides to this procedure are:
No incremental backup; full backup only
No granularity of what gets backed up
Backup
In a location of your choosing, create a file called backup.cmd
backup.cmd
——-
@echo off
FOR /F "tokens=*" %%i IN ('docker ps -q') DO docker stop %%i
net stop com.docker.service
taskkill /F /IM "Docker Desktop.exe"
taskkill /F /IM com.docker.admin.exe
taskkill /F /IM com.docker.backend.exe
taskkill /F /IM com.docker.build.exe
taskkill /F /IM com.docker.dev-envs.exe
wsl --shutdown
copy /y C:\Users\username\AppData\Local\Docker\wsl\disk\docker_data.vhdx C:\backup
net start com.docker.service
"C:\Program Files\Docker\Docker\Docker Desktop.exe"
exit
——
In Task Scheduler, make a task with administrative privileges. Set it to run at a time when users will not be using this service.
If you want to run this manually, execute it in an administrative console window.
Restore
In a location of your choosing, create a file called restore.cmd
restore.cmd
——-
@echo off
FOR /F "tokens=*" %%i IN ('docker ps -q') DO docker stop %%i
net stop com.docker.service
taskkill /F /IM "Docker Desktop.exe"
taskkill /F /IM com.docker.admin.exe
taskkill /F /IM com.docker.backend.exe
taskkill /F /IM com.docker.build.exe
taskkill /F /IM com.docker.dev-envs.exe
wsl --shutdown
copy /y C:\backup\docker_data.vhdx C:\Users\username\AppData\Local\Docker\wsl\disk
net start com.docker.service
"C:\Program Files\Docker\Docker\Docker Desktop.exe"
exit
——
Execute it in an administrative console window.
Beta Was this translation helpful? Give feedback.
All reactions