Docker for Mac and VMWare Fusion - macos

So I have Docker for Mac installed and I would like to use VMWare Fusion rather than VirtualBox. Doing a search, I came across https://docs.docker.com/machine/drivers/vm-fusion/ using docker-machine. Not sure if that's what I'm looking for but when the Docker app starts I can see that the VMWare Fusion machine is suspended. Is there additional setup required to get new containers to run off of VMWare Fusion rather than VirtualBox?

Docker for Mac actually uses a native virtual machine implementation called xhyve based on the OSX Hypervisor.framework. Docker for Windows uses HyperV in a similar fashion.
Using a native VM implementation allows for tighter integration into the Docker app, rather than doing everything via Virtualbox's VBoxManage command as with the original boot2docker image and Docker Toolbox setup.

Related

Docker for windows 10 home edition

For installing docker on windows home edition , there are two options if I don't want to run virtual machine.
Which is better :
installing docker desktop ?
installing using wsl2 ?
I'm not going to answer which one is better but instead present some points you should consider before choosing one. However, if you're using Windows Home Edition, I'm afraid your choice is to either:
upgrade to Windows Pro and install Docker with the original Windows backend
install WSL2, then install Docker with the WSL2 backend
This is mentioned on the Docker website. Instructions for Windows Home/WSL2 here and for Windows Pro/Non-WSL2 here.
Bind mount performance
If you care about bind-mounts, where you share a directory between the host OS filesystem (Windows) and the container filesystem (usually Linux), you'll want to compare performance between these two options.
If you want faster bind-mount performance on WSL2, you should mount shared files in the Linux filesystem (the part of your system dedicated to WSL2) for mounting. So you'd want to use \\wsl$\Ubuntu-18.04\home\<user name>\Project instead of C:\Users\<user name>\Project. Docker has more info about this here and Microsoft has more info here.
Start time
Other points mentioned on the Docker website include that Docker has a faster cold-start time with the WSL2 backend compared to the previous version.
Changing Docker system settings
Using WSL2, you'll also have to modify the WSL2 configuration if you want to reduce the amount of memory Docker can use for example. See details here as referenced from the Docker on WSL2 best practices.
I see no two options, at least in the terms you used stating the questions.
On Windows 10 you install Docker Desktop and this can have WSL2 as backend.
On Windows 10 Home, specifically, you can install Docker Desktop with WSL2 backend.
For reference see "Install Docker Desktop on Windows Home" documentation page where only one option is described, and not two.

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

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

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/.

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

Could I use docker or something similar to deploy windows application?

I am running a game on Windows, and it requires every OS can only run one. And If I want to run more, currently I open vmware and run the game inside. But the problem is it takes too much memory and disk to run a whole another virtual OS. I know docker will reduce this, but it doesn't seem to support Windows.
Am I right? If so, any other solutions?
Docker uses LXC (linux containers) so cannot run a Windows operating system.
You can use docker on Windows using a boot2docker VM, but this is not the same as docker running a Windows operating system (your containers will run unix based operating systems inside the boot2docker VM).
To do what you're after, you'll need to use separate VMs.

Resources