道客

Last published : Oct 24, 2026
要安装 App Layering 服务,您需要将设备部署到虚拟机监控程序上的虚拟机。

如何安装 WSL 和 Docker

这些说明适用于所有 App Layering 映像类型,但主要用于非持久性 VDI 桌面的完整 UserLayer 部署。请参阅 适用于旧版 WSL 的手动安装步骤 中的相关指南。对于 App Layering,这些说明将为已部署的 VDI 虚拟机池中的域用户提供 WSL 和 Docker 作为基础。
尝试使用 WSL 和/或 Docker 的域用户必须是域管理员组的成员。在这些步骤的用户部分,代表域用户使用单独的管理员帐户将不起作用。
存在其他未在下面介绍的先决条件,例如,确保虚拟机已启用嵌套虚拟化(如果您计划使用 WSL2),并存在计算机 GPO 以创建和填充用户需要成为其成员的“docker-users”组。Windows 10/11 版本应与所使用的 WSL/Docker 版本保持一致。

分步指南 - Docker / WSLv2(Windows 10 或 11)

  1. 在新的应用程序层(首选)或操作系统层修订版中,以管理员身份执行以下操作:
    a. dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    b. dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    c. 禁用 WSL 自动更新
    i.  reg add hklm\software\Microsoft\Windows\CurrentVersion\Lxss /t REG_DWORD /v AutoUpdate /d 0 /f
    d. 重新启动以安装功能,然后重新登录
    e. 从 Microsoft/WSL 下载并安装最新的稳定版 WSL
    i.  Move the download to a place where users can access it later (do this BEFORE installing it)

    ii.  Install of WSL must be done from the same folder location that users will be using

        1.  Do not use the wsl --install command

        2.  Sample install command: 'msiexec -i wsl.2.3.26.0.x64.msi /L*V wsl-install.log'

        3.  Suggestion: create a "UserInstall.cmd" script containing a similar msiexec command to be used in step 2.a

    iii.  If an older WSL installation is present it should be uninstalled first (using 'msiexec /x' to fully remove it)

    iv.  It is not recommended to install a specific distro into the app layer. Users can choose a distro later if they wish to.

    v.  Do not remove the WSL .msi installer from this folder. Users will need to apply this exact .msi during their setup later.
    f. 使用“wsl --version”验证 WSL 是否正常工作
    g. (可选)将 .wslconfig 添加到默认用户配置文件
    i.  Existing users would need to copy this to their own profile

    ii.  The default network operation for wsl2 should be established in a file named .wslconfig and placed in \Users\Default.

        1.  .wslconfig contains two lines: '[wsl2]' and 'networkingMode=mirrored' (without quotes, case as shown)

        2.  Only new users-layer users will automatically have this file copied to their profile area

        3.  Place a copy of the .wslconfig file in the WSL installer location for existing users to copy
    h. 下载并安装 Docker
    i.  See [Install Docker Desktop on Windows](https://docs.docker.com/desktop/install/windows-install/)

    ii.  Docker will log out

    iii.  Log back in (Docker will start itself, but this can be ignored now)

    iv.  'Accept' terms and Close the Docker Desktop sign-in window

    v.  In the latest releases of Docker, an error popup may appear at this time (see exact text of this popup in Info section below). Docker now seems to demand the presence of an installed distro. This popup can be dismissed and ignored, and Docker will exit due to this. That too can be ignored at this point in the installation steps.
    i. 完成层(对于应用程序层,必须包含在映像中;不能弹性交付)
  2. 对于每个登录用户:
    a. 找到并运行 WSL 安装程序(从步骤 1.e.i 保存)
    i.  This will be a fast and minimal install that only sets up reparse-points for the user

    ii.  This is a one-time install for each user, but can be used again if wsl problems arise

    iii.  Do not copy the wsl .msi to an alternate location before installing it (e.g., 'cd \WSL' and repeat the original/similar msiexec command)
    b. 使用 powershell 安装私有发行版:(使用 ubuntu-1604 发行版的示例)
    i.  Invoke-WebRequest -Uri [https://aka.ms/wsl-ubuntu-1604](https://aka.ms/wsl-ubuntu-1604) -OutFile ~/Ubuntu.zip -UseBasicParsing

    ii.  mkdir ~/distros

    iii.  Expand-Archive ~/Ubuntu.zip ~/distros/Ubuntu

    iv.  Run the installer as admin ~/distros/Ubuntu/ubuntu*.exe (exact name is version specific)

    v.  Provide a username and password you will use to log into wsl, and complete the install

    vi.  When this completes, update the distro in the distro-specific fashion ( sudo apt-get update; sudo apt-get upgrade )

    vii.  (Optional) create a desktop shortcut to the installed distro's main application

    viii.  Leave your distro window running for the remaining steps
    c. 从开始菜单启动 Docker Desktop
    i.  Allow Docker to initialize and start the docker engine

    ii.  Important: Docker needs to be made aware of your distro

        1.  In Docker, go to 'Setting->Resources→WSL Integration'

            a.  Enable the 'additional distro' that matches yours

            b.  Disable the 'default WSL distro' selection

    iii.  Also, you can control Docker auto-startup in 'Settings→General'

    iv.  Remember that your distro/WSL session needs to be started before the Docker engine can start successfully

升级

每当推出升级的 WSL/Docker App Layering 时,每个受影响的用户都需要使用先前的 WSL/Docker 层进行修复操作。