Can Windows Containers be hosted on linux?

Is this possible to run Windows Containers on Linux ? The scenario is based on a solution written in the .NET (old net) and the Linux user that wants to run this with Docker to provide a net462 written API on the localhost .

I am using a beta from Docker for windows

If no, then why can windows run linux containers and not vice-versa?

EDIT:

As some time has passed and this question is a popular one. I'd like to add one note here that the workaround is to use the new netstandard. It allowed me to pack 4.6.2 framework into new library.


Updated at 2018:

Original answer in general is right, BUT several months ago, docker added experimental feature LCOW (official github repository).

From this post:

Doesn't Docker for Windows already run Linux containers? That's right. Docker for Windows can run Linux or Windows containers, with support for Linux containers via a Hyper-V Moby Linux VM (as of Docker for Windows 17.10 this VM is based on LinuxKit).

The setup for running Linux containers with LCOW is a lot simpler than the previous architecture where a Hyper-V Linux VM runs a Linux Docker daemon, along with all your containers. With LCOW, the Docker daemon runs as a Windows process (same as when running Docker Windows containers), and every time you start a Linux container Docker launches a minimal Hyper-V hypervisor running a VM with a Linux kernel, runc and the container processes running on top.

Because there's only one Docker daemon, and because that daemon now runs on Windows, i t will soon be possible to run Windows and Linux Docker containers side-by-side, in the same networking namespace . This will unlock a lot of exciting development and production scenarios for Docker users on Windows.

Original:

As mentioned in comments by @PanagiotisKanavos, containers are not for virtualization, and they are using the resources of the host machine . As a result, for now windows container cannot run "as-is" on linux machine.

But - you can do it by using VM - as it works on windows. You can install windows VM on your linux host, which will allow to run windows containers.

With it, IMHO run it this way on PROD environment will not be the best idea.

Also, this answer provides more details.


No, you cannot run windows containers on Linux but Windows Server comes packaged with base image of ubuntu OS ( after september 2016 beta service pack ). That is the reason you can run linux on windows and not other wise. Check out here. https://thenewstack.io/finally-linux-containers-really-will-run-windows-linuxkit/

You can change between OS containers Linux and windows by right clicking on the docker in tray menu.

在这里输入图像描述

在这里输入图像描述


You can use Windows Containers inside a virtual machine (the guest OS should match the requirements - Windows 10 Pro or Windows 2016).

For example you can use VirtualBox , just enable Hyper-V inside System / Acceleration / Paravirtualization Interface.

After that if Docker doesn't start up because of an error, use the "Switch to Windows containers..." in the settings.

(this could be moved as a comment to the accepted answer, but I don't have enough reputation to do so)

链接地址: http://www.djcxy.com/p/18200.html

上一篇: Docker,它是什么,目的是什么

下一篇: Windows容器可以托管在Linux上吗?