Running linux container on docker windows - linux

I installed Docker for windows on a windows 10 box. It required me to enable the HyperV feature on it. Everything installed correctly and is running fine.
Although one thing took me by surprise. I am actually able to run a linux container on docker windows. I thought cross-containerization is not possible conceptually. Can anyone please help me understand how does this work?

HyperV is used to spin up a Linux VM to run containers. Docker is still running Linux containers under the covers, the native Windows containers are still being developed.

Basically, you are running a Linux Container on a Linux Machine rather than Windows. Windows runs a VM in Hyper-V when you download the Docker for Windows. You can open Hyper-V Manager and see a Linux VM will be running. Currently Docker for Windows is in beta which supports the Docker natively which needs Windows 10 build no. greater than 14393.222 or a Windows Server 2016.

Related

how docker executes windows container?

As i understand, docker use linux VM even i install it on windows OS.
So i agree that windows docker can execute linux container.
But then, how windows docker executes windows container?
Can i make container with other OS?
In other words, can i make container(having windows & windows app) and run it on linux docker?
As i know, docker does not support other OS in image, but it looks like some people is saying it is possible that make windows container and run it on linux.
Docker container shares just one kernel, is it possible?
To answer your questions:
That first statement is incorrect. Docker uses the underlying OS feature (container) to run its stack/daemon. The OS is responsible for instantiating the container itself. That means a Linux OS will instantiate a Linux container and Windows host will instantiate a Windows container. So, if you install Docker on Windows you don't have a Linux VM. Instead, you have the ability to instantiate Windows containers directly without the need to run Linux at all. To answer the question itself: The process is pretty much the same as Linux. You pull images with docker pull and then run them with docker run. You can also build images with docker build and everything else.
Windows containers can only run on Windows hosts (either Windows 10/11 or Windows Server). For Linux containers, that's not so strict. You can run Linux containers on Windows for development purposes, by leveraging the Windows Subsystem for Linux (WSL).
There's much more details on these on the Microsoft documentation page: https://cda.ms/4nN

Azure windows server 2019 install docker

I hope somebody can help me with this issue.
I have a windows server 2019 hosted on azure. I would like to install docker for some tests.
Before to jump to docker, I updated the operative system
I downloaded docker desktop from docker website.
Installation went without any issue.
But when I try to start the app, I get the error that the Hyper-V is not running.
At this point, in the server management tool => add features I checked if Hyper-v was installed and if containers was also installed, After this I went to services.msc and restarted Hyper-v managment and also set to auto hypervisorlaunchtype and restarted the VM. When I logged in back, I had the same issue.
I know this is a case of nested virtualisation, but I was wondering if is achievable on a cloud platform.
Can please anyone help me to understand this and if its possible or/and what I am doing wrong
I tried to install the docker desktop in my environment and it was successful with out any issue. Created a vm with windows server 2019 and updated to latest and installed docker desktop from here Install Docker Desktop on Windows and it is running as expected.
Nested virtualizations is supported in azure but all the vm sizes not support nested virtualization, So Try to deploy the VM with any of the following series D_v3; Ds_v3; E_v3; Es_v3; F2s_v2 – F72s_v2; M and check.

Running an msi from Docker. Which host OS should choose

I want to create a docker container which installs an MSI application. I know i will be using the microsoft\widows\servercore image for this. Which host os i should use for this purpose. Will this image can be created and deployed in a Linux distribution??
If you're running a Windows container, you need to use Docker on Windows.
In general, containers can only run on the OS that they're designed for, but it is possible using Docker for Windows and Docker for Mac to run Linux containers since they provide a miniature Linux VM to run those containers. However, Docker on non-Windows OSes doesn't provide a copy of Windows to run containers with, so you have to use Windows to run Windows containers.
If you want your container to be deployable on a Linux host, it will need to be using a Linux container image.

Windows Container vs Docker Container and Azure Container Services/Kubernetes cluster with Linux OS

In the previous threads I asked a question about the way to move the Windows Containers into a Azure Container Services, and I received a great help
Deploying Windows Containers (created with Docker) into Azure Container Service
Pushing Windows Containers (built with Docker) into Azure Container Service (ACS) with Linus OS
I successfully created a Docker container on the Windows Server 2016 and through a Docker hub I moved the Docker container into a Kubernetes cluster with Windows Nodes where I was able to run these containers
However, after I ran a demo for my manager, I now need to conduct an additional research as my manager has some questions.
First of all, he is curious why the docker container cannot run on Windows (I do use Docker command when create the container) After all the Docker container should be platform independent and run in any environment, on both Windows and Linux
Also, I understand that there should be a switch between Windows and Linux when running Docker builds. However, on Windows Server 2016 with Containers there is no docker switch. Only command line is available.
Is that possible to switch between Linux and Windows modes on the command line and also, just in case, I am NOT working with Windows Containers, I am trying to work with Docker Containers.
Is that a true statement that a Docker Container with the .Net Core application (which is also cross platform cannot run on Linux)?
Thank you very much for your answer!
he is curious why the docker container cannot run on Windows (I do use
Docker command when create the container) After all the Docker
container should be platform independent and run in any environment,
on both Windows and Linux
To short, containers are not for virtualization, and they are using the resources of the host machine.
Windows container need .dll files, but Linux does not have those .dll files. And Linux based container need libraries, but windows does not have those.
Is that possible to switch between Linux and Windows modes on the
command line
About containers switch, please refer to this article. we can follow this article to configure docker for windows.
Is that a true statement that a Docker Container with the .Net Core
application?
As far as I know, for now, we can't run windows-based container on Linux.

How to run Linux Docker images on Windows Server 2016?

I have used docker for windows with linux containers on windows 10 sucessfully - but now I want to use a new shiny Windows Server 2016 for that task - but how?
I have installed the docker features using this guide: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_server
Installing the normal docker.msi fails because the windows version ist not Windows 10.
Unfortunately, when trying to run any linux vm docker throws the error:
image operating system "linux" cannot be used on this platform.
In the docker beta I could switch between using windows containers or linux containers - but how I can do that on Server 2016= There is no tray icon or else.
It is now possible to run Linux containers on Windows Server 2016 although it's not as simple as running the Docker for Windows installer. Full instructions are in the following answer: Linux Docker container on Windows Server 2016
Updated answer
Windows Server (from version 1709) now supports Linux Containers.
For more information read:
https://blog.docker.com/2017/09/docker-windows-server-1709/
Old answer
Unfortunately, as of now (January 2017) I don't think it is possible.
Windows Server 2016 has native container support. These containers use the Windows kernel so it is only possible to run Windows processes. To run Linux containers you would need the MobyLinux VM.
For now you have to run Linux containers on Windows 10.
For more information read "2. You have to use Windows inside the containers (for now)" from this article by Elton Stonema.
https://blog.sixeyed.com/windows-containers-and-docker-5-things-you-need-to-know/
And a similar question on Stack Overflow.
Linux Docker container on Windows Server 2016

Resources