Docker desktop (Windows 10 Pro) — 为什么在“设置”->“资源”中没有“高级”选项卡?

Docker desktop (Windows 10 Pro) — Why is there no Advanced tab in Settings->Resources?

为什么设置->资源中没有高级选项卡?

您可以在Docker Engine

中添加或修改图片信息

您运行 WSL 2 集成了吗?看起来大部分设置不适用于该场景,并且 'Advanced' 选项卡已被删除。 (参见 https://admcpr.com/running-docker-desktop-with-the-new-wsl-2-backend/)。

如果您 运行 docker 桌面具有新的 WSL 2 后端并在 Settings/General 中启用 Use the WSL 2 based engine : show settings/general

如果您想修改 WSL 2 的配置设置以明确限制可用资源,您可以通过在用户配置文件目录中创建 .wslconfig 文件来实现

打开WindowsTerminal/CMD/PowerShell和运行以下命令:

# turn off all wsl instances such as docker-desktop
wsl -- shutdown

notepad "$env:USERPROFILE/.wslconfig"

然后在 .wslconfig 文件中添加这些项目:

[wsl2]
kernel=<path>              # An absolute Windows path to a custom Linux kernel.
memory=<size>              # How much memory to assign to the WSL2 VM.
processors=<number>        # How many processors to assign to the WSL2 VM.
swap=<size>                # How much swap space to add to the WSL2 VM. 0 for no swap file.
swapFile=<path>            # An absolute Windows path to the swap vhd.
localhostForwarding=<bool> # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true).

# <path> entries must be absolute Windows paths with escaped backslashes, for example C:\Users\adamc\kernel
# <size> entries must be size followed by unit, for example 8GB or 512MB

例如:

[wsl2]
memory=2GB            
processors=4 

然后保存文件并重新启动 docker-桌面服务。