Can I create a docker swarm network with few linux nodes and few windows node being part of the same overlay network? - docker-machine

Is it possible to create a docker swarm network which contains a mix of Linux machines and windows machines each running their own containers on them ?
If yes, is there any way I can test such a setup on an Ubuntu desktop? Right now I use docker-machine to create multiple VM nodes on my Ubuntu and make them join the docker swarm. I need to test the setup with a mix of linux and windows nodes. I could not find any way to create a windows VM on a linux machine using docker-machine. What is the recommended way of testing a setup like this, if any at all ?

Have you considered something like Azure? Docker Machine natively supports their platform: https://docs.docker.com/machine/drivers/azure/.

Related

Is it possible to connect docker linux to docker on windows?

I have 2 computers.
One on ubuntu 18.04
One on windows 10
I have docker installed on both of them.
I create a swarm between the two but I am not able to
create an overlay network over the two of them.
Is it possible to connect docker linux and docker windows ?
Plus I would like to know if it's possible for me to run
Mongodb container on windows and linux and make them communicate together ?
I intend to build a mongodb sharded cluster.

Docker Container vs Virtual Machine

I am using docker desktop on windows 10. I downloaded an image for windows server core 1909.
then created two containers from the same image.
Docker run -it mcr.microsoft.com/windows/servercore:1909 powershell.exe
when I ran sysinfo on both, it gave me different hostname for both OS.
how do I see that kernel is shared? because I see these are two different VMs which is no different than hyper-v VM of the core OS.
I though docker container is sharing a kernel but I don't see the same OS underneath?
any idea?
Ok i got the answer also. There is concept of hyper-v isolation level for containers in windows. so if the host is not same version as of the container, you will get what you call hyper-v isolation which is essentially not a process isolation, its rather a virtual machine like traditional thing. no shared kernel.
True container concept which is actually shared kernel is only possible on windows server host and when used container version which is also same.
https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-1909%2Cwindows-10-1809

Managing dockers on Windows

I'm using dockers on a Windows server 2016, to run all sorts of Windows applications/tasks.
There are several solutions to manage dockers, such as swarm and marathon, but they don't work on Windows (or do work on Windows but via virtual box vm, which is problematic for my needs).
In the future mesos and dc/os will support Windows, but in the meanwhile,
is there an alternative that can work for Windows?
I'd suggest setting up a docker container to manage the rest of your docker.
A couple containers which do exactly that:
http://portainer.io/
DockerUI
If you don't like that you could use a (local) gui to manage it, the only one I know of is:
simple-docker-ui

What's the difference between Docker for Windows and Docker on Windows?

Docker on Windows appears to be what's coming built into Windows Server 2016? and supports running Windows inside a Docker container and using Windows as a Docker container host. Does this support Linux? I don't think so, I think it only supports running Windows Docker containers. This also appears to be maintained by Microsoft.
Docker for Windows appears to be a separate install created by the Docker team to bring Linux Docker to Windows. So Windows can be the Docker host but all containers are still just normal Linux containers. Does this support Windows containers? I don't think so, I think it only supports running Linux Docker containers. This also appears to be maintained by Docker.
One other interesting note is that Docker Tools for Visual Studio appears to only support Docker Desktop for Windows and not Docker on Windows.
What I'm really looking for are the stated differences bettwen the two, some sort of good comparison. What features are each trying to acheive, where are they similar, where are they different. Will they always be different or will they ever come together?
Docker on Windows is a colloquial way to refer to just the Docker Engine running on Windows. I find it helpful to think of this as a Windows Container Host, so yes Windows containers only. This would be what you would run on a Windows Server 2016 machine. So maybe a better name is Docker for Windows Server which I believe people have used as well. I still prefer a Windows Container Host. Which means it only has the Docker Engine at the end of the day, doesn't even need to have any of the Docker clients (docker CLI, docker-compose, etc).
Docker Desktop for Windows is a product meant for running both Linux and Windows containers on Windows. It's not meant for a production environment, and instead is meant for a desktop/client SKU of Windows, hence the Windows 10 requirement. So you could think of this as Docker for Windows 10. Because DfW can run both container types, there are different configurations that it sets up on your machine:
When using Linux Containers, DfW creates a MobyLinuxVM with Hyper-V inside of which it runs Linux containers, transparently, as if they were running on the Windows 10 host.
When using Windows Containers, DfW installs the same components as Docker on Windows so that you have a Windows Container Host. You have the Windows Docker Engine setup now. This then allows you to run windows containers on a Win 10 client SKU.
Theoretically you could install DfW on Windows Server, I haven't tried so I don't know if this would fail, but why would you want to run Linux containers on a Windows Host in production? In production, you would have Linux Container Hosts that run linux containers and Windows Container Hosts that run windows containers, this would avoid overhead and simplify things.
Just to add on top of Wes's answer on Docker for Windows and few details about the experimental LCOW which is what you are looking for a side by side execution of Windows and Linux containers on the Windows host machine.
Right now there are two ways to run Linux containers with Docker for Windows and Hyper-V:
Run Linux containers in a full Linux VM - this is what Docker
typically does today.
Run Linux containers On Windows (LCOW) with Hyper-V isolation - this is a new option in Docker for Windows.
In the 1st approach, Docker for Windows windows will have docker daemon service on the Windows host machine as well as it will be available on Linux MOBY VM. So basically, you will have 2 different docker hosts. One which is running on your Windows Host Machine, Managing only Windows Containers and other which is running on your Linux Moby VM and Managing only Linux Containers.
It is important to note that, All Linux Containers will share a Single Linux Kernel on Moby VM and All Windows Containers will share Single Windows Kernel on Windows Host Machine.
Things are really getting interesting with the 2nd approach,
Linux containers with Hyper-V isolation run each Linux container in an optimized Linux VM with just enough OS to run containers. Each Linux container has its own kernel and its own VM sandbox. They're also managed by Docker on Windows directly.
The main difference here in this approach is that there is only one docker daemon service is running on Windows Host Machine and managing both Windows and Linux containers.
All Windows Containers will Share Single Windows Kernel while Each Linux Container will have its own Linux Kernel
To understand more in details, please refer
https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/linux-containers

Kubernetes Solo development environment windows

this project seems to be great to start out with kubernetes on osx https://github.com/TheNewNormal/kube-solo-osx but is there somethign similar for windows?
You can use minikube to set up a Kubernetes cluster on a Windows machine. It'll create a virtual machine running Linux in which it will set up Kubernetes for you. You can then connect to Kubernetes running in that VM from your Windows environment.
If you want to setup a local Kubernetes cluster with both Linux and Windows-based nodes, have a look at kubernetes-windows-vagrant, which will use Vagrant t create the VMs and set up the environment for you.
As far as I know, there is no windows based Kubernetes dev env.

Resources