12

是否有关于如何在 Docker EE for Windows Server 2016 中使用 Linux 容器的最新指南?我找到的所有指南(例如这个)都在使用预览版,据我所知,它是两个主要版本,并且已经过时了 2 年。

我遇到的另一个问题是我必须手动下载和安装 docker,因为服务器没有直接的互联网连接。容器图像将通过 Artifactory 下载。

4

2 回答 2

25

NOTE: WSL2

With the release of WSL 2, please be mindful that parts (if not all) off the below is very likely to be outdated.

Original post:


Update:

I previously forgot to mention that before you install, you need to have the Hyper-V Role installed. If you server is a VM, make sure that you have enabled nested virtualization.

Original answer

I don't know of any updated guides, but I have come up with the following from various sources (sources in the bottom), which is confirmed to work for running LCOW on Windows Server 2019:

Basically, you install a normal up-to-date Docker, enable experimental and fix the kernel path.

Assuming that Docker is not already installed, and never has been, running the following commands in an elevated PowerShell get you there:

PS C:\...> Install-Module DockerMsftProvider -Force

PS C:\...> Install-Package Docker -ProviderName DockerMsftProvider -Force

PS C:\...> Restart-Computer

PS C:\...> $configfile =@"
{
    "experimental":true
}
"@

PS C:\...> $configfile|Out-File -FilePath c:\ProgramData\docker\config\daemon.json -Encoding ascii -Force

PS C:\...> [Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")

PS C:\...> Restart-Service Docker

Then you need to go to https://github.com/linuxkit/lcow/releases and download the newest release and unpack it to C:\Program Files\Linux Containers.

If necessary, rename the file bootx64.efi to kernel.

Note

Please check out the last of the sources that mention some applications that will not work. I am still struggling with switching it to the old method of running the containers in a Moby VM for this specific reason.

Sources:

于 2019-08-28T12:00:20.767 回答
0

我遇到了同样的问题,预览版(提供者:DockerProvider)和上述答案中的版本(提供者:DockerMsftProvider)都不能正常工作。

最后,清理这些版本的 Docker 并简单地安装 Docker for Windows 效果很好。

于 2021-04-15T20:03:10.030 回答