我在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 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

其他回答

弃用' latest '标签

为了鼓励更好的容器实践,我们在所有Windows基映像中都弃用' latest '标签。在2019日历年年初,我们将不再发布标签;我们将从可用标记列表中删除它。

我们强烈建议您声明希望在生产环境中运行的特定容器标记。“latest”标签是specific的反义词;除了图像名称,它不会告诉用户容器实际是什么版本。你可以阅读更多关于版本兼容性和选择适当的标签在我们的容器文档。

https://techcommunity.microsoft.com/t5/containers/windows-server-2019-now-available/ba-p/382430#

右击Docker实例 进入设置 守护进程 先进的 设置“experimental”:true 重启码头工人

 {
      "registry-mirrors": [],
      "insecure-registries": [],
      "debug": true,
      "experimental": true
    }

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

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

相关Github-Issue

你需要先使用Linux平台,然后才能在Windows上运行:

docker pull --platform linux php
docker run -it php

参见博文Docker for Windows Desktop 18.02 with Windows 10 Fall Creators Update。

版本:Windows 10

步骤1:右键单击Docker实例并进入设置

步骤2:基本到高级,并设置“实验”:true

步骤3:重启Docker

步骤4:安装dockerfile成功(例如:docker build -t williehao/cheers2019)