Windows 上安装 Podman 或Docker 时 WSL 更新问题及手动解决指南
·
在 Windows 系统上安装 Podman 时,常遇 WSL 更新失败(错误 0x80248014),因 Windows Update 被禁用导致。以下手动指南绕过此问题,步骤简明,适用于 Windows 10/11(需启用 WSL)。
第一步:手动更新 WSL 内核
- 访问 https://github.com/microsoft/WSL/releases,下载最新 x64 MSI 文件(如
wsl.2.6.1.0.x64.msi)。 - 双击 MSI 文件安装(需管理员权限)。
- 重启计算机生效。
第二步:验证状态并设置 WSL 2
以管理员身份打开命令提示符:
-
检查状态:
wsl --status正常输出示例:
Default Version: 2 Kernel version: 5.15.153.1 WSL version: 2.1.5.0 -
设置默认版本:
wsl --set-default-version 2正常输出示例:
For information on key differences between WSL 1 and WSL 2 please visit https://aka.ms/wsl2 The operation completed successfully. -
查看发行版:
wsl --list --verbose正常输出示例:
NAME STATE VERSION * Ubuntu Stopped 2 Debian Stopped 2
第三步:安装 Ubuntu
-
下载 Ubuntu 22.04: https://aka.ms/wslubuntu2204(AppxBundle 文件)。
-
安装:
Add-AppxPackage "C:\路径\到\Ubuntu2204-*.AppXBundle"正常输出示例:
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 Successfully installed Ubuntu 22.04 LTS -
启动:
wsl -d Ubuntu首次运行正常输出示例:
Installing, this may take a few minutes... WSL automatic registration completed Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: youruser New password: Retype new password: passwd: password updated successfully Installation successful! youruser@hostname:~$ -
更新:
sudo apt update && sudo apt upgrade -y正常输出示例(简化):
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] ... Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
第四步:安装并测试 Podman
-
检查发行版:
wsl --list --verbose正常输出示例:
NAME STATE VERSION * Ubuntu Running 2 -
进入 Ubuntu:
wsl -d Ubuntu正常输出示例:
youruser@hostname:~$ -
安装:
sudo apt install podman -y正常输出示例(简化):
Reading package lists... Done Building dependency tree... Done The following additional packages will be installed: ... 0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded. Setting up podman (4:4.9.5+ds1-1ubuntu1) ... -
验证:
podman --version正常输出示例:
podman version 5.2.4 -
测试:
podman run hello-world正常输出示例:
Trying to pull registry.fedoraproject.org/hello-world:latest... Getting image source signatures Copying blob ... Writing manifest to image destination Storing signatures hello-world:latest Hello from Podman! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Podman client contacted the Podman daemon. 2. The Podman daemon pulled the "hello-world" image from the Docker Hub. 3. The Podman daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Podman daemon streamed that output to the client, so you see it here. To try something more ambitious, you can run: podman run -it --name test alpine sh With a local volume, you can run: podman run -it -v /path/on/host:/path/in/container busybox sh Visit https://docs.podman.io for more examples.
注意事项
- 启用虚拟化(BIOS 中 VT-x/AMD-V)。
- 建议恢复 Windows Update 服务以便自动更新。
- 常见问题:MSI 失败时检查权限;AppxBundle 路径用引号;Podman 慢时调整内存
wsl --manage Ubuntu --set-memory 4GB。
此法高效,WSL 与 Podman 集成顺畅。如遇错误,提供输出排查。
更多推荐
所有评论(0)