Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker命令行切换到在Windows Core计算机上运行linux容器_Windows_Docker - Fatal编程技术网

Docker命令行切换到在Windows Core计算机上运行linux容器

Docker命令行切换到在Windows Core计算机上运行linux容器,windows,docker,Windows,Docker,我继承了一台Windows Server核心计算机,我想在该计算机上的docker中运行基于linux的容器。它当前设置为运行基于windows的容器,因此我想切换到运行linux容器 当我尝试使用基于linux的映像时,出现以下错误: PS C:\Program Files\Docker> docker pull my-linux-based-image Pulling from my-linux-based-image image operating system "linux" ca

我继承了一台Windows Server核心计算机,我想在该计算机上的docker中运行基于linux的容器。它当前设置为运行基于windows的容器,因此我想切换到运行linux容器

当我尝试使用基于linux的映像时,出现以下错误:

PS C:\Program Files\Docker> docker pull my-linux-based-image
Pulling from my-linux-based-image
image operating system "linux" cannot be used on this platform
在我的Windows桌面计算机上,我会使用系统托盘中的Docker桌面上下文菜单在linux和Windows容器之间切换,但在Windows Core中不可用。我可以从命令行进行此切换吗

我看到了使用
dockerli.exe
的建议,但我没有安装它,即使在确保安装了最新的docker软件包之后。我需要单独的cli相关软件包吗

以下是在我的Windows Core计算机上安装docker的版本信息:

PS C:\Program Files\Docker> docker version
Client: Docker Engine - Enterprise
 Version:           18.09.8
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        90e30bdf98
 Built:             07/16/2019 17:13:22
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Enterprise
 Engine:
  Version:          18.09.8
  API version:      1.39 (minimum version 1.24)
  Go version:       go1.10.8
  Git commit:       90e30bdf98
  Built:            07/16/2019 17:11:04
  OS/Arch:          windows/amd64
  Experimental:     false

Dockercli
-SwitchDaemon
选项在这里应该有帮助

$ ./DockerCli.exe
Usage: DockerCli.exe [-SwitchDaemon] [-Version]
-Version: Show the Docker for Windows version information
-SwitchDaemon: Point the Docker CLI to either Linux containers or Windows containers
-SharedDrives: List the shared drives
您可以使用选项控制要切换的引擎

-SwitchLinuxEngine
-SwitchWindowsEngine
更多信息

希望这有帮助

更新:

dockerli.exe
可在
程序文件
文件夹中找到


在我的例子中,就是在这里
/c/Program\Files/Docker/Docker/DockerCli.exe

您必须安装Docker Enterprise才能从Windows切换到Linux容器。有关更多信息,请参阅。

在powershell中,我在下面运行了确切的命令-

./dockerli.exe-SwitchDaemon

注意-在运行上述命令之前,请移动到此路径

  **C:\Program Files\Docker\Docker** 

谢谢这台机器上好像没有Dockerli。这是独立docker相关安装的一部分吗?更新了我的答案。该exe文件对我来说仍然不存在。此处相同,找不到该exe,该exe安装为:1。安装模块-名称dockermstfprovider-Force。2.安装包-Name docker-ProviderName dockermstfprovider-forcedockerli.exe仅与Windows docker Desktop一起安装。我在Windows Server 2019上运行Docker,并执行了前一条评论中的两个ps命令(并重新启动了该框),虽然这是安装Docker的原因(根据在上提供的相同命令),但我仍处于Windows容器模式。因此,我正在寻找与OP相同的答案:如何通过cmd行切换到linux conainer模式,因为当安装Docker时,Docker Desktop没有状态try-like。也许会有帮助。它很笨重,但这很有效。“在Windows Server 2019上运行Linux容器”部分显示了
安装软件包Docker-ProviderName DockerProvider-RequiredVersion preview
-这是使其工作的关键(从今天开始)。是否仍然需要安装预览版本?