Run docker windows container on linux

Can Windows containers be hosted on Linux?

Is it possible to run Windows containers on Linux? The scenario is based on an application written in .NET (old net) and the Linux user that wants to run this with Docker needs to provide a net462 written API on the localhost . I am using the beta version of Docker Desktop for Windows. If no, then why can Windows run Linux containers and not vice-versa? 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 .NET Standard. It allowed me to pack the 4.6.2 framework into a new library.

Not possible — To build and run Windows containers, a Windows system with container support is required.

@Sebastian506563 because docker runs VirtualBox virtualization behind the scenes to make Linux containers to run on Windows. I would guess theoretically it will be possible the other way as well, just docker did not implement it.

With VMs, each vm has its own operating system. With containers, there is base OS image and each container is adding a new thin layer on top the base. In docker’s this base OS linux based. i.e. your windows container cannot user the base as it is different. blog.risingstack.com/…

10 Answers 10

Q: Can Windows containers run on Linux?

A: No. They cannot.

Containers are using the underlying operating system resources and drivers, so Windows containers can run on Windows only, and Linux containers can run on Linux only.

Q: But what about Docker for Windows? Or other VM-based solutions?

A: Docker for Windows allows you to simulate running Linux containers on Windows, but under the hood a Linux VM is created, so still Linux containers are running on Linux, and Windows containers are running on Windows.

Bonus: Read this very nice article about running Linux docker containers on Windows.

Q: So, what should I do with a .NET Framework 462 application, if I would like to run in a container?

A: It depends. Consider the following recommendations:

  • If it is possible, move to .NET Core. Since .NET Core brings support to most major features of .NET Framework, and .NET Framework 4.8 will be the last version of .NET framework
  • If you cannot migrate to .NET Core — As @Sebastian mentioned — you can convert your libraries to .NET Standard, and have two versions of the application — one on .NET Framework 4.6.2, and one on .NET Core — it is not always obvious. Visual Studio supports it pretty well (with multi-targeting), but some dependencies can require extra care.
  • (Less recommended) In some cases, you can run Windows containers. Windows containers are becoming more and more mature, with better support in platforms like Kubernetes. But to be able to run .NET Framework code, you still need to run on base image of «Server Core», which occupies about 1.4 GB. In same rare cases, you can migrate your code to .NET Core, but still run on Windows Nano server, with an image size of 95 MB.
Читайте также:  Idle python kali linux

Leaving also the old updates for history

Update 2: 08.2018

If you are using Docker-for-Windows, you can run now both Windows and Linux containers simultaneously: Running Docker Windows and Linux Containers Simultaneously

Bonus: Not directly related to the question, but you can now run not only the Linux container itself, but also an orchestrator like Kubernetes: Kubernetes is Now Available In Docker Desktop Stable Channel

Updated at 2018:

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

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, it 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.

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 a Windows container cannot run «as-is» on a Linux machine.

Читайте также:  Linux mint fedora opensuse

But — you can do it by using VM — as it works on Windows. You can install a Windows VM on your Linux host, which will allow to run Windows containers.

With it, IMHO running it this way in a production environment will not be the best idea.

Also, this answer provides more details.

Источник

Linux machine with docker deploy windows container

I have a Linux server with 16GB ram with docker host installed. I would like to deploy on it a Windows Server container. Is it possible? Anyone has just tried this solution?

1 Answer 1

Update 2019

Microsoft has improved the network options for containers and now allows multiple containers per pod with improved namespace.

In theory (original answer Oct 2015):

There is no «Windows container» running on a Linux host.
And a Linux container would not run directly on a Windows server, since it relies on system calls to a Linux kernel.

You certainly can run those Linux containers on any Windows machine through a VM.
That is what docker toolbox will install.

There will be support for docker on Windows soon, but that would be for Windows container, not Linux containers.

Update 2017: yes, LinuxKit allows to run a linux container through aa Hyper-V isolation wrapper on a Windows platform, through a minimal Linux OS built from linuxkit.
That is still the same idea: linux running inside a VM on Windows.
That is not a Linux server deployed on a Windows server: only deployed inside a Linux server running in a VM on Windows.

Actually. (update Dec. 2016)

Kubernetes 1.5 includes alpha support for both Windows Server Containers, a shared kernel model similar to Docker, and Hyper-V Containers, a single-kernel model that provides better isolation for multi-tenant environments (at the cost of greater latency).
The end result is the ability to create a single Kubernetes cluster that includes not just Linux nodes running Linux containers or Windows nodes running Windows containers, but both side by side, for a truly hybrid experience.
For example, a single service can have PODs using Windows Server Containers and other PODs using Linux containers.

  • The Kubernetes master must still run on Linux due to dependencies in how it’s written. It’s possible to port to Windows, but for the moment the team feels it’s better to focus their efforts on the client components.
  • There is no native support for network overlays for containers in windows, so networking is limited to L3. (There are other solutions, but they’re not natively available.)
    The Kubernetes Windows SIG is working with Microsoft to solve these problems, however, and they hope to have made progress by Kubernetes 1.6’s release early next year.
  • Networking between Windows containers is more complicated because each container gets its own network namespace, so it’s recommended that you use single-container pods for now.
  • Applications running in Windows Server Containers can run in any language supported by Windows. You CAN run .NET applications in Linux containers, but only if they’re written in .NET Core. .NET core is also supported by the Nano Server operating system, which can be deployed on Windows Server Containers.
Читайте также:  No pages found linux

Источник

Можно ли запустить Windows приложение в Linux Docker container?

Возможно глупый вопрос, но всё же.
Есть машинка с Debian, на ней установлен Docker CE.
И мой вопрос — можно ли запустить в контейнере Docker Windows приложение (например я хочу попробовать www.passmark.com/products/pt.htm)
EN-форумы утверждают, что нет, но это было до выхода Docker for Windows.
Сейчас же на странице Docker висит красивая диаграмма, утверждающая, что можно запустить любое приложение на любой ОС, но видимо речь о собственных приложениях 🙂

Оценить 2 комментария

Ni55aN

Battle_Hamster

You can run Windows-based containers on Windows Server 2016 and Windows 10. Windows-based containers require a Windows kernel to run, in the same way that Linux-based containers require a Linux kernel to run. You can even run Windows-based containers on a Windows virtual machine running on an macOS or Linux host. Docker Machine is not necessary if you run macOS 10.10.3 Yosemite, Windows Server 2016, or Windows 10.

Battle_Hamster

nurbek_nurjanov

Нет.
Докер — это не особо большая НАДСТРОЙКА над ядром Линукса.

Он просто удобным способом позволяет изолировать и запускать родные приложения Линукса.
Из неродных вариантов — разве только запуск Линуксовых приложений из под Докера ФриБСД или напротив запуск Фришных приложение из под Докера Линуха — так как эти операционные системы близки.

С Виндовс сие невозможно в принципе.
Тот Докер что устанавливается в Виндовс — тянет за собой полноценный Линукс. И только это делает возможным запуска Линукс приложений в Докере Виндовс.

Обратная процедура также нетривиальна.

Если вам нужен аналог Докера для запуска приложений Виндовс — обратитесь к технологии Windows Container.

Источник

Оцените статью
Adblock
detector