【问题标题】:Docker Toolbox image operating system "windows" cannot be used on this platformDocker Toolbox 镜像操作系统“windows”不能在这个平台上使用
【发布时间】:2018-09-19 22:08:29
【问题描述】:

我已经在我的 Windows 10 家用电脑上安装了 docker 工具箱。 我面临两个问题。

1.当我点击 docker quickstart 终端时,它会给出 unix/linux 提示。 2.当我尝试运行这个命令docker build(在windows命令提示符下),我得到这个错误:image operating system "windows" cannot be used on this platform.

docker build .
Sending build context to Docker daemon  2.584MB
Step 1/17 : FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base
2.0-nanoserver-1709: Pulling from microsoft/aspnetcore
407ada6e90de: Pulling fs layer
10288d944410: Pulling fs layer
4880fefbf99e: Pulling fs layer
df193da25173: Waiting
60ab1f0af432: Waiting
f4d477fb2108: Waiting
878954290d5e: Waiting
ae61d8e352f7: Waiting
88faab7b6014: Waiting
e7331f21ccb7: Waiting
image operating system "windows" cannot be used on this platform

如何更正我的配置以使其接受我的 Windows 10 操作系统。

如何配置 docker 工具箱,以便对我的 dot net 应用程序进行 docker 化。

我的问题是,如果 docker 工具箱在我的系统上安装了一个 linux vm,它将如何帮助我使用诸如“docker build”之类的命令。 ,它给出了这个错误:图像操作系统“windows”不能在这个平台上使用。所以,基本上,我什么都做不了。

正确吗?或者有什么方法可以在 Windows 10 主页上调用 docker?

先谢谢了。

【问题讨论】:

  • 我的问题是,如果 docker 工具箱在我的系统上安装了一个 linux 虚拟机,它会帮助我使用“docker build”之类的命令吗? ,它给出了这个错误:图像操作系统“windows”不能在这个平台上使用。所以,基本上,我什么都做不了。那是对的吗?或者有没有办法可以在 Windows 10 主页上调用 docker?

标签: docker docker-toolbox


【解决方案1】:

FROM microsoft/aspnetcore:2.0-nanoserver-1709改为microsoft/dotnet:2.1-aspnetcore-runtime

解释:

microsoft/aspnetcore:2.0-nanoserver-1709 is a windows native container image.只能在windows 10或windows server上运行。要在Linux容器上运行,拉取与here中描述的类似的Linux镜像

【讨论】:

  • 这只是解释如何切换到基于 linux 的映像。但是 Windows 10 应该可以运行基于 Windows 的映像,我们该怎么做呢?
【解决方案2】:

根据上一个答案,我将基础更改为:microsoft/dotnet:2.1-aspnetcore-runtime AS base 并且构建到 microsoft/dotnet:2.1-sdk AS 构建在 Dockerfile 中,现在它可以工作了。

【讨论】:

    【解决方案3】:

    要能够运行 Windows 容器,首先需要安装 Hyper-V:以管理员身份打开 PowerShell 并输入 Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -All。重新启动计算机,启动 Docker Desktop,然后右键单击 windows 任务栏右下角的 Docker Desktop,然后单击“切换到 windows 容器”

    您现在应该可以运行任何基于 Windows 的 docker 映像了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-13
      • 2017-06-06
      • 2021-07-31
      • 2020-12-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多