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
Related
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
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.
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.
I have windows server 2016 which has docker in built into it... so I am able to create windows image based containers and play around with them.
But now I want to create run linux based images, not able to do that... get below error
PS C:\Users\harishr> docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
image operating system "linux" cannot be used on this platform
I did installed docker-machine to create linux machine, but not getting command line options to do that
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.