跳到内容
观澜涉川 · 札记EN

在 Windows 上运行 docker 出错:no matching manifest for linux/amd64 10.0.22621 in the manifest list entries

· 约 1 分钟阅读

在 Windows 上拉取或者运行 Linux 容器时候,可能会遇到如下错误。比如

> docker pull python:3.12-slim
no matching manifest for linux/amd64 10.0.22621 in the manifest list entries

这是因为 Docker 在尝试拉取 Windows 镜像,因此找不到镜像。

解决办法

Stack Overflow 上的问题 《Docker: “no matching manifest for windows/amd64 in the manifest list entries”》 下面,已经有了很多回复。

综合起来有几种方法:

  1. 设置 experimental 为 true。可通过两种方式修改,修改完之后需要重启 Docker 服务:
  • 在 daemon.json 里设置 experimental 为 true。也就是添加 "experimental": true。
  • 或者在 Docker Deskop 的图形界面里,设置 experimental 为 true。
  1. 切换 Docker Deskop 的后端容器。也有两种方法:
  • 点击系统托盘里的 Docker 图标,然后点击 Switch to Linux Containers...。然后按提示操作。
  • 或者通过命令行工具 DockerCli.exe 操作。在 Docker 的安装目录下执行: ./DockerCli.exe -SwitchDaemon。
  1. 在运行 docker 命令时,指定 --platform 参数。比如 docker pull --platform linux python:3.12-slim。该参数需要先开启 experimental,即在 daemon.json 里设置 experimental 为 true,然后重启。

以上就是 Stack Overflow 上的回复的汇总。

但是我并没有验证这些办法。这是因为我并没有安装 Docker Desktop,而是通过二进制文件安装 Docker。于是只能运行原生的 Windows 容器。见官方文档说明:

Binary packages on Windows include both dockerd.exe and docker.exe. On Windows, these binaries only provide the ability to run native Windows containers (not Linux containers).