我在Windows上使用Docker,当我试图用这个命令拉一个PHP图像时

$ docker pull php

我收到了这样的信息:

Using default tag: latest
latest: Pulling from library/php no matching manifest for windows/amd64 
        in the manifest list entries

我该如何解决这个问题?


当前回答

这可能不仅仅发生在windows容器上!

现在所有的Node.Js docker映像都是不可拉的。总是检查你要拉之前的图像。

相关Github-Issue

其他回答

这可能不仅仅发生在windows容器上!

现在所有的Node.Js docker映像都是不可拉的。总是检查你要拉之前的图像。

相关Github-Issue

更新为Windows 10 20H2

转到Docker配置 进入Docker Engine选项卡 将行“experimental”:false更改为“experimental”:true 使用应用&重启按钮重新启动Docker


你也可以手动修改配置文件,用你最喜欢的代码编辑器打开它(可视代码,notepad++…),例如:

# BACKUP Your file with PowerShell
Copy-Item -Path C:\ProgramData\Docker\config\daemon.json -Destination C:\ProgramData\Docker\config\daemon.json.backup

# Open the file with Visual Code
code C:\ProgramData\Docker\config\daemon.json

或者直接用Powershell更改字符串

# Set Path in variable
$FILE = "C:\ProgramData\Docker\config\daemon.json"

# Replace '"experimental": false' to '"experimental": true'
(Get-Content -Path $FILE) -replace '"experimental": false','"experimental": true' | Set-Content -Path $FILE

# Check the file content
type $FILE

输出示例

PS C:\WINDOWS\system32> type $FILE
{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": true
}

在您需要重新启动Docker守护进程后

PS C:\WINDOWS\system32> Restart-Service docker

检查服务状态

PS C:\WINDOWS\system32> Get-Service docker
Status   Name               DisplayName
------   ----               -----------
Running  docker             Docker Engine

考虑一下您正在导入的应用程序——它们是基于Windows的吗? 如果不是,则需要运行Linux容器。

如果不使用实验模式,你只能在一种容器风格中使用Docker。 如果您像上面提到的那样激活实验模式,那么您可以根据在撰写文件中拉入的应用程序的需要使用Windows和Linux容器。

重点说明:实验性- Docker仍在开发中。

Docker run McR.microsoft.com/windows/servercore:ltsc2016

试试上面的命令。 您正在提取的内容应该与您所在的底层Windows版本兼容。如果你使用的是Windows server 2016,上面的内容也适用。

关注这条线索获取更多信息

https://github.com/docker/for-win/issues/3761

在Windows上,必须编辑文件守护进程。Json或windows-daemon-options。在Windows上,配置文件的默认位置是%programdata%\docker\config\daemon。Json或%programdata%\docker\resources\windows-daemon-options.json

json文件上的可选字段特性,允许用户启用或禁用特定的守护进程特性。示例:{" features":{"buildkit": true}}启用buildkit作为默认的docker映像构建器。