Is it possible to run Windows Containers on Linux? The scenario is based on an app 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 beta version 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.
Solution 1 - Using VirtualBox
As Muhammad Sahputra suggested in this post, it is possible to run Windows OS inside VirtualBox (using VBoxHeadless - without graphical interface) inside Docker container.
Also, a NAT setup inside the VM network configurations can do a port forwarding which gives you the ability to pass-through any traffic that comes to and from the Docker container. This eventually, in a wide perspective, allows you to run any Windows-based service on top of Linux machine.
Maybe this is not a typical use-case of a Docker container, but it definitely an interesting approach to the problem.
Solution 2 - Using Wine
For simple applications and maybe more complicated, you can try to use wine inside a docker container.
This docker hub page may help you to achieve your goal.
I hope that Docker will release a native solution soon, like they did with docker-machine on Windows several years ago.
No, you cannot run windows containers directly 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)
Update2: 08.2018 If you are using Docker-for-Windows, you can run now both windows and linux containers simultaneously: https://blogs.msdn.microsoft.com/premier_developer/2018/04/20/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 orchestrator like kubernetes: https://blog.docker.com/2018/07/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).
From this post:
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.
Windows containers are not running on Linux and also You can't run Linux containers on Windows directly.
You can run MSSQL and DOTNET on Linux, and hence inside Linux containers, nowadays.
See: https://hub.docker.com/r/microsoft/mssql-server-linux/
Also: https://hub.docker.com/r/microsoft/dotnet/