The following WSL configuration changes are purely optional, but can help to save a little more space on your system drive.
[boot]
# enable systemd
systemd = true
[automount]
# automount Windows drives on launch
enabled = true
# the directory where all drives will be mounted
root = /mnt/
# ensures the `/etc/fstab` file is processed on launch
mountFsTab = true
# sets parameters for the windows file system under linux
optios = "metadata,uid=1000,gid=1000,umask=22,fmask=11,case=off"
[network]
# host settings
hostname = DemoHost
# prevent WSL from creating the /etc/hosts file (so you can create your own)
generateHosts = false
# prevent WSL from creating the /etc/resolv.conf file (so you can create your own)
generateResolvConf = false
[interop]
# set whether WSL will support interop processes like launching Windows apps from the Linux command line
enabled = true
# append the Windows path to the Linux path
appendWindowsPath = true
[user]
# set the default user on launch
default = DemoUser
[boot]
# set a command to run on launch
command = service docker start
# settings apply across all Linux distros running on WSL 2
[wsl2]
# limits VM memory to no more than 4GB
memory = 4GB
# limits VM to 2 virtual processors
processors = 2
# sets available swap storage space to 8GB
swap = 8GB
# sets the swapfile path
swapfile = D:\\WSL\\wsl-swap.vhdx
# disable page reporting so WSL keeps all allocated memory and releases none back to Windows when it's free
pageReporting = false
# ensures ports opened on the VM are available at `localhost:port`
localhostForwarding = true
# ensures support for GUI applications (Windows 11 only)
guiApplications = true
# ensures support for nested virtualization (run docker on docker - Windows 11 only)
nestedVirtualization = true
# turn on or off a console showing contens of dmesg when opening a WSL 2 distro (Windows 11 only)
debugConsole = false
# the number of milliseconds that a VM is idle before it is shut down (Windows 11 only)
vmidleTimeout = 60000