How docker desktop runs linux containers on Window

2020-03-24 08:37发布

I have installed Docker for Windows on my Windows 10 laptop. Now because of this "Docker for Windows" I can run Linux containers too on my windows 10 Laptop. How is it made possible? I have some queries, am I missing something here?

See image for better visibility Docker on Windows Machine running Linux container

1) My machine which is Windows 10 has Windows Kernel. Right?

2) When I select option to RUN Linux containers, I think a Linux VM is run on top of my Windows 10 machine and on top of that Linux Containers are run. Is that correct?

3) If a Linux VM is run on TOP of Windows machine, whose kernel is used? Linux VM kernel or windows 10 kernel?

4) And then how can we say containers doesn't include operating system, for windows they are running a Linux VM.

5) Now if I run a second container, will it run on top of the already running Linux VM or will it launch a new linux VM again? I think it will run on the same running linux VM but asking so that there isn't any confusion.

6) If a Linux VM is run on TOP of Windows machine, then do we have any control on the Linux VM being run like version of Linux VM, etc or it's always the same and we don't have any control over it?

7) If a Linux VM is run on top of Windows machine, then is the windows resources not visible to the Linux VM and hence to the container? If it's visible then how can Linux VM talk to Windows Host?

1条回答
狗以群分
2楼-- · 2020-03-24 09:26

1) My machine which is Windows 10 has Windows Kernel. Right?

A: Yes.

2) When I select option to RUN Linux containers, I think a Linux VM is run on top of my Windows 10 machine and on top of that Linux Containers are run. Is that correct?

A: Yes. A hyper-v linux vm with the name mobylinux will be there, you can see it in hyper-v manager.

3) If a Linux VM is run on TOP of Windows machine, whose kernel is used? Linux VM kernel or windows 10 kernel?

A: The hyper-v vm use linux kernel.

4) And then how can we say containers doesn't include operating system, for windows they are running a Linux VM.

A: Not sure where you get information. The docker image only has file system, e.g. ubuntu16.04 filesystem, but do not have kernel. When container run, it will use the filesystem of image & share the kernel of host(Maybe you just mean it not have own kernel, so you call it not have operation system?)

5) Now if I run a second container, will it run on top of the already running Linux VM or will it launch a new linux VM again? I think it will run on the same running linux VM but asking so that there isn't any confusion.

A: Yes, it will run on the same linux vm again.

6) If a Linux VM is run on TOP of Windows machine, then do we have any control on the Linux VM being run like version of Linux VM, etc or it's always the same and we don't have any control over it?

A: No, see this discussion, seems cannot ssh to the vm, just some workaround to access the filesystem of the vm, so not find any way to change the kernel or linux distribution.

7) If a Linux VM is run on top of Windows machine, then is the windows resources not visible to the Linux VM and hence to the container? If it's visible then how can Linux VM talk to Windows Host?

A: In theory, you can mount the windows folder to linux vm, then container can use the linux folder with volume. And docker for windows have done this for you, right click the icon in your taskbar, you could see something like follows, just do like the picture:

enter image description here

查看更多
登录 后发表回答