我在 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 上使用 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
我该如何解决这个问题?
"experimental": true
设置为true& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon .
请参阅以下链接:https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce - aviggiano您处于Windows容器模式。因此,如果您不确定要拉取的镜像是否为Windows架构构建,则需要切换到Linux容器。
在我的情况下,问题是我使用的Windows操作系统版本不支持我尝试获取的标签。使用较旧的标签使我成功了。
具体来说:
docker pull mcr.microsoft.com/windows/nanoserver:1903
出现错误
docker pull mcr.microsoft.com/windows/nanoserver:1803-amd64
成功了
winver
确保您的主机机器上的 Windows 版本是新于或等于映像中的版本。 - cowlinator另一种可能的方法是:
在系统托盘中,右键单击 Docker 图标,然后单击 切换到 Linux 容器
。
(Docker for Windows,Community Edition,版本18.03.1)
我在Windows 10中通过以管理员身份运行Powershell解决了这个问题:
cd "C:\Program Files\Docker\Docker"
然后:
./DockerCli.exe -SwitchDaemon
"experimental": false
更改为 "experimental": true
应用并重新启动
按钮重启 Docker您也可以手动修改配置文件,使用您喜欢的代码编辑器(例如 Visual Code、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
你需要先进行 Linux 平台的拉取,然后才能在 Windows 上运行:
docker pull --platform linux php
docker run -it php
查看博客文章使用Windows 10秋季创作者更新版的Docker for Windows Desktop 18.02。
--platform
标志也可以使用。不过这可能会重新下载一些内容。 - Peter Mortensen