简体   繁体   English

Windows版Docker和Windows版Docker有什么区别?

[英]What's the difference between Docker for Windows and Docker on Windows?

Docker on Windows appears to be what's coming built into Windows Server 2016 ? Windows Server 2016似乎内置了Windows 上的Docker and supports running Windows inside a Docker container and using Windows as a Docker container host. 并支持在Docker容器中运行Windows并将Windows用作Docker容器主机。 Does this support Linux? 这是否支持Linux? I don't think so, I think it only supports running Windows Docker containers. 我不这么认为,我认为它仅支持运行Windows Docker容器。 This also appears to be maintained by Microsoft. 这似乎也由Microsoft维护。

Docker for Windows appears to be a separate install created by the Docker team to bring Linux Docker to Windows. 用于Windows的Docker似乎是由Docker团队创建的单独安装,用于将Linux Docker引入Windows。 So Windows can be the Docker host but all containers are still just normal Linux containers. 因此Windows可以作为Docker主机,但是所有容器仍然只是普通的Linux容器。 Does this support Windows containers? 这是否支持Windows容器? I don't think so, I think it only supports running Linux Docker containers. 我不这么认为,我认为它仅支持运行Linux Docker容器。 This also appears to be maintained by Docker. 这似乎也由Docker维护。

One other interesting note is that Docker Tools for Visual Studio appears to only support Docker Desktop for Windows and not Docker on Windows . 另一个有趣的注意事项是, 用于Visual Studio的Docker工具似乎仅支持Windows的Docker桌面 ,而不支持Windows的 Docker

What I'm really looking for are the stated differences bettwen the two, some sort of good comparison. 我真正要寻找的是两者之间的既定差异,这是一种很好的比较。 What features are each trying to acheive, where are they similar, where are they different. 每个功能都试图实现哪些功能,它们在哪些方面相似,在哪些方面不同。 Will they always be different or will they ever come together? 他们会永远不同还是会在一起?

Docker on Windows is a colloquial way to refer to just the Docker Engine running on Windows . Windows上的Docker是一种通俗的方式,仅指Windows上运行的Docker引擎 I find it helpful to think of this as a Windows Container Host , so yes Windows containers only . 我认为将其视为Windows容器主机很有帮助,因此, 仅Windows容器 This would be what you would run on a Windows Server 2016 machine. 这就是您将在Windows Server 2016计算机上运行的内容。 So maybe a better name is Docker for Windows Server which I believe people have used as well. 因此,也许更好的名字是Windows Server的Docker ,我相信人们也曾经使用过。 I still prefer a Windows Container Host. 我仍然更喜欢Windows容器主机。 Which means it only has the Docker Engine at the end of the day, doesn't even need to have any of the Docker clients (docker CLI, docker-compose, etc). 这意味着它在一天结束时只有Docker引擎,甚至不需要任何Docker客户端(docker CLI,docker-compose等)。

Docker Desktop for Windows is a product meant for running both Linux and Windows containers on Windows . 用于Windows的Docker桌面是一种旨在在Windows同时运行Linux和Windows容器的产品。 It's not meant for a production environment , and instead is meant for a desktop/client SKU of Windows, hence the Windows 10 requirement. 不是针对生产环境 ,而是针对Windows的桌面/客户端SKU,因此是Windows 10要求。 So you could think of this as Docker for Windows 10. Because DfW can run both container types, there are different configurations that it sets up on your machine: 因此,您可以将其视为Windows 10的Docker。由于DfW可以运行两种容器类型,因此在您的计算机上设置了不同的配置:

  • When using Linux Containers, DfW creates a MobyLinuxVM with Hyper-V inside of which it runs Linux containers, transparently, as if they were running on the Windows 10 host. 使用Linux容器时,DfW创建带有Hyper-V的MobyLinuxVM,在其中透明地运行Linux容器,就像它们在Windows 10主机上运行一样。
  • When using Windows Containers, DfW installs the same components as Docker on Windows so that you have a Windows Container Host. 使用Windows容器时,DfW在Windows上安装与Docker相同的组件,以便您拥有Windows容器主机。 You have the Windows Docker Engine setup now. 您现在已经安装了Windows Docker Engine。 This then allows you to run windows containers on a Win 10 client SKU. 然后,这使您可以在Win 10客户端SKU上运行Windows容器。

Theoretically you could install DfW on Windows Server, I haven't tried so I don't know if this would fail, but why would you want to run Linux containers on a Windows Host in production? 从理论上讲,您可以在Windows Server上安装DfW,但我没有尝试过,所以不知道这样做是否会失败,但是为什么要在生产中的Windows Host上运行Linux容器? In production, you would have Linux Container Hosts that run linux containers and Windows Container Hosts that run windows containers, this would avoid overhead and simplify things. 在生产中,您将拥有运行linux容器的Linux容器主机和运行Windows容器的Windows容器主机,这可以避免开销并简化事情。

Just to add on top of Wes's answer on Docker for Windows and few details about the experimental LCOW which is what you are looking for a side by side execution of Windows and Linux containers on the Windows host machine. 只是在Wes针对Windows的Docker的答案上,以及关于实验性LCOW的一些细节上,这就是您正在Windows主机上并行执行Windows和Linux容器的目标。

Right now there are two ways to run Linux containers with Docker for Windows and Hyper-V: 目前,有两种方法可以通过Docker for Windows和Hyper-V运行Linux容器:

  1. Run Linux containers in a full Linux VM - this is what Docker 在完整的Linux VM中运行Linux容器-这就是Docker
    typically does today. 今天通常如此。
  2. Run Linux containers On Windows (LCOW) with Hyper-V isolation - this is a new option in Docker for Windows. 在Windows (LCOW)上以Hyper-V隔离运行Linux容器-这是Docker for Windows中的新选项。

In the 1st approach, Docker for Windows windows will have docker daemon service on the Windows host machine as well as it will be available on Linux MOBY VM. 在第一种方法中,适用于Windows的Docker窗口将在Windows主机上具有docker daemon服务,并将在Linux MOBY VM上提供。 So basically, you will have 2 different docker hosts. 因此,基本上,您将拥有2个不同的Docker主机。 One which is running on your Windows Host Machine, Managing only Windows Containers and other which is running on your Linux Moby VM and Managing only Linux Containers . 一种在Windows主机上运行,​​仅管理Windows容器 ,另一种在Linux Moby VM上运行,仅管理Linux容器

It is important to note that, All Linux Containers will share a Single Linux Kernel on Moby VM and All Windows Containers will share Single Windows Kernel on Windows Host Machine. 重要的是要注意,所有Linux容器将在Moby VM上共享一个Linux内核,所有Windows容器将在Windows主机上共享一个Windows内核。

在此处输入图片说明

Things are really getting interesting with the 2nd approach, 第二种方法确实让事情变得有趣起来,

Linux containers with Hyper-V isolation run each Linux container in an optimized Linux VM with just enough OS to run containers. 具有Hyper-V隔离功能的Linux容器可在经过优化的Linux VM中运行每个Linux容器,而Linux VM仅具有足以运行容器的操作系统。 Each Linux container has its own kernel and its own VM sandbox. 每个Linux容器都有自己的内核和自己的VM沙箱。 They're also managed by Docker on Windows directly. 它们也由Windows上的Docker直接管理。

在此处输入图片说明

The main difference here in this approach is that there is only one docker daemon service is running on Windows Host Machine and managing both Windows and Linux containers. 这种方法的主要区别在于, Windows主机上仅运行一个docker daemon服务,并且同时管理Windows和Linux容器。

All Windows Containers will Share Single Windows Kernel while Each Linux Container will have its own Linux Kernel 所有Windows容器将共享一个Windows内核,而每个Linux容器将具有自己的Linux内核

To understand more in details, please refer https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/linux-containers 要了解更多详细信息,请参阅https://docs.microsoft.com/zh-cn/virtualization/windowscontainers/deploy-containers/linux-containers

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

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