简体   繁体   English

如何在 Windows 上运行 Windows Docker 容器而没有“打开 \\.\pipe\docker_engine_windows:系统找不到指定的文件”?

[英]How can I run a Windows Docker container on Windows without "open \\.\pipe\docker_engine_windows: The system cannot find the file specified"?

I am running Docker 20.10.22 on Windows 10 Pro 64-bit.我在 Windows 10 Pro 64 位上运行 Docker 20.10.22。

In my Docker Desktop settings, I have using WSL 2 disabled:在我的 Docker 桌面设置中,我禁用了 WSL 2:

在此处输入图像描述

I have Hyper-V enabled:我启用了 Hyper-V:

在此处输入图像描述

I have Docker Desktop in Windows containers mode instead of Linux containers mode.我在 Windows 容器模式下有 Docker 桌面,而不是 Linux 容器模式。

Despite this, when I try to run this Windows Docker container , I this error message:尽管如此,当我尝试运行这个 Windows Docker container时,我得到了这个错误信息:

>docker run --rm -it mcr.microsoft.com/windows:ltsc2019
docker: Error response from daemon: open \\.\pipe\docker_engine_windows: The system cannot find the file specified.
See 'docker run --help'.

Do I need to change any Docker or Windows settings in order to be able to successfully run the Windows container?我是否需要更改任何 Docker 或 Windows 设置才能成功运行 Windows 容器?

The issue was that both "Containers" and "Hyper-V" need to be enabled.问题是“容器”和“Hyper-V”都需要启用。

To fix this, I ran为了解决这个问题,我跑了

Enable-WindowsOptionalFeature -Online -FeatureName containers -All

in an Administrator PowerShell and then restarted my Windows computer.在管理员 PowerShell 中,然后重新启动我的 Windows 计算机。 (Note that I already had Hyper-V enabled.) After Docker Desktop finished starting, running (请注意,我已经启用了 Hyper-V。)Docker 桌面完成启动后,运行

docker run --rm -it mcr.microsoft.com/windows:ltsc2019

successfully pulled and ran the image.成功拉取并运行镜像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM