User Tools

Site Tools


apps:docker:dockerdesktopforwindows

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
apps:docker:dockerdesktopforwindows [2024-06-10 16:38] Manuel Freiapps:docker:dockerdesktopforwindows [2024-06-13 02:48] (current) Manuel Frei
Line 1: Line 1:
 ====== Docker Desktop for Windows ====== ====== Docker Desktop for Windows ======
  
-FIXME FIXME FIXME+===== Purpose / Usage ===== 
 + 
 +Docker Desktop is a UI to help developers working with the Docker engine. <color #ed1c24>It is **not** intended for use in production.</color> 
 + 
 +  * It only works within an interactive user session 
 +  * There are memory usage problems: [[https://github.com/docker/for-win/issues/12944|GitHub: docker/for-win Issue #12944]] 
  
 ===== Configuration ===== ===== Configuration =====
Line 24: Line 30:
 </code> </code>
  
-The default log driver is json-file. All the lines that are written to the stdout/console are saved to a json file. The log file is created at the same time the container is created and will grow until the container gets deleted. This can lead to disks getting full. To prevent this situations, logrotation can be configured +The default log driver is json-file. All the lines that are written to the stdout/console are saved to a json file. The log file is created at the same time the container is created and will grow until the container gets deleted. This can lead to disks getting full. To prevent this situations, log rotation can be configured
 + 
 +<code JavaScript daemon.json> 
 +
 +  "log-driver": "json-file", 
 +  "log-opts":
 +    "max-size": "100m", 
 +    "max-file": "3" 
 +  } 
 +
 +</code> 
 + 
 +Together with the default configuration, it looks like this.
 <code JavaScript daemon.json> <code JavaScript daemon.json>
 { {
Line 64: Line 82:
 </code> </code>
  
-===== WSL Distributions =====+===== WSL2 Backend ===== 
 + 
 +WSL2 is the recommended backend 
 + 
 +  * "%LOCALAPPDATA%\Docker\wsl\data\ext4.vhdx" ("C:\Users\xxx\Docker\wsl\data\ext4.vhdx"
 +  * "%LOCALAPPDATA%\Docker\wsl\main\ext4.vhdx" ("C:\Users\xxx\Docker\wsl\main\ext4.vhdx")
  
  
Line 79: Line 102:
   docker-desktop         Running         2   docker-desktop         Running         2
 </code> </code>
- 
- 
  
 <code> <code>
 wsl -d docker-desktop wsl -d docker-desktop
 </code> </code>
- 
  
 <code> <code>
Line 97: Line 117:
 </code> </code>
  
 +==== Shrink VHDX ====
  
-===== Shrink VHDX ===== +The virtual disks (VHDX) for the WSL2 VMs will grow to contain all the container data. If they get too big you have to do an offline shrink operation to get them back to a smaller size.
- +
- +
-"%LOCALAPPDATA%\Docker\wsl\data\ext4.vhdx" ("C:\Users\xxx\Docker\wsl\data\ext4.vhdx" +
-"%LOCALAPPDATA%\Docker\wsl\main\ext4.vhdx" ("C:\Users\xxx\Docker\wsl\main\ext4.vhdx")+
  
 +Make sure, the Docker Engine is stopped and close Docker Desktop for Windows.
  
 +Shutdown the WSL2 distributions.
 +<code>
 +wsl --shutdown
 +</code>
  
 +Shrink both disks with "Full" mode. Check this [[https://learn.microsoft.com/en-us/powershell/module/hyper-v/optimize-vhd?view=windowsserver2022-ps|link]] for more information about the trimming modes.
 +<code>
 Optimize-VHD -Path "C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx" -Mode Full Optimize-VHD -Path "C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx" -Mode Full
 Optimize-VHD -Path "C:\Users\xxx\AppData\Local\Docker\wsl\main\ext4.vhdx" -Mode Full Optimize-VHD -Path "C:\Users\xxx\AppData\Local\Docker\wsl\main\ext4.vhdx" -Mode Full
 +</code>
  
-<code>+If Optimize-VHD is done, just start Docker Desktop for Windows again.
  
 +Example.
 +<code>
 PS C:\> Get-Item C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx PS C:\> Get-Item C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx
- 
  
     Directory: C:\Users\xxx\AppData\Local\Docker\wsl\data     Directory: C:\Users\xxx\AppData\Local\Docker\wsl\data
- 
  
 Mode                 LastWriteTime         Length Name Mode                 LastWriteTime         Length Name
 ----                 -------------         ------ ---- ----                 -------------         ------ ----
 -a----        04/06/2024     15:29   210780553216 ext4.vhdx -a----        04/06/2024     15:29   210780553216 ext4.vhdx
- 
- 
-https://learn.microsoft.com/en-us/powershell/module/hyper-v/optimize-vhd?view=windowsserver2022-ps 
- 
-PS C:\> Optimize-VHD -Path c:\test\dynamic.vhdx -Mode Full 
-PS C:\> Optimize-VHD -Path c:\test\dynamic.vhdx -Mode Retrim 
- 
  
 PS C:\> wsl --shutdown PS C:\> wsl --shutdown
- +PS C:\> Optimize-VHD C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx -Mode Full
-PS C:\> Optimize-VHD C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx  -Mode Full +
- +
 PS C:\> Get-Item C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx PS C:\> Get-Item C:\Users\xxx\AppData\Local\Docker\wsl\data\ext4.vhdx
- 
  
     Directory: C:\Users\xxx\AppData\Local\Docker\wsl\data     Directory: C:\Users\xxx\AppData\Local\Docker\wsl\data
- 
  
 Mode                 LastWriteTime         Length Name Mode                 LastWriteTime         Length Name
 ----                 -------------         ------ ---- ----                 -------------         ------ ----
 -a----        04/06/2024     16:04    17706254336 ext4.vhdx -a----        04/06/2024     16:04    17706254336 ext4.vhdx
- 
- 
- 
- 
- 
- 
- 
 </code> </code>
- 
  
 ===== Links ===== ===== Links =====
apps/docker/dockerdesktopforwindows.1718030331.txt.gz · Last modified: 2024-06-10 16:38 by Manuel Frei