Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker in windows need Hyper-V enabled?

Tags:

docker

Does Docker require Hyper-V enabled in windows? If yes, why?

What is the role of Hyper-V in this case?

I m using Windows 10 home. What is the alternative for hyper-V to install Docker pls?

like image 739
catchkarthik Avatar asked Mar 05 '23 08:03

catchkarthik


1 Answers

If you use windows10 professional & your bios supports hardware virtualization, suggest you to enable Hyper-V.

When run linux container in windows10, in fact, it still needs a linux system as a docker host, because linux container cannot share kernel with windows.

If enable hyper-v, docker-windows will auto setup a MobyLinuxVm in hyper-v as a virtual machine which act as the host machine of docker. Compared to traditional solution, I mean install a linux in virtualbox. Hyper-v has much better performance, because it does not depend on windows os, it something like setup based on hardware just like vmware-esx.

Finally, if you use home version of windows10, you had to install a virtualbox as the host machine of docker and use docker toolbox, details refers to https://docs.docker.com/toolbox/overview/ for legacy desktop solution.

Update some additional points you may want to know:

a) linux container:

Docker container had to share kernel with host, there are no linux kernel on windows, so for all situations, you had to have a virtual machine with linux as docker host, either hyper-v or virtualbox if no hyper-v support.

b) windows container:

In theory, windows container could share the kernel of windows, so no virtual machine needed.

But microsoft support container too late compared to linux, so for different host, it use different solutions, see next chapter from microsoft web site:

Windows Containers include two different container types, or runtimes.

Windows Server Containers – provide application isolation through process and namespace isolation technology. A Windows Server Container shares a kernel with the container host and all containers running on the host. These containers do not provide a hostile security boundary and should not be used to isolate untrusted code. Because of the shared kernel space, these containers require the same kernel version and configuration.

Hyper-V Isolation – expands on the isolation provided by Windows Server Containers by running each container in a highly optimized virtual machine. In this configuration, the kernel of the container host is not shared with other containers on the same host. These containers are designed for hostile multitenant hosting with the same security assurances of a virtual machine. Since these containers do not share the kernel with the host or other containers on the host, they can run kernels with different versions and configurations (with in supported versions) - for example all Windows containers on Windows 10 use Hyper-V isolation to utilize the Windows Server kernel version and configuration.

like image 118
atline Avatar answered Mar 28 '23 17:03

atline