docker desktop 如何在 Windows 机器上运行 linux 容器 [英] How docker desktop runs linux containers on Windows machine

查看:140
本文介绍了docker desktop 如何在 Windows 机器上运行 linux 容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的 Windows 10 笔记本电脑上安装了 Docker for Windows.现在因为有了这个Docker for Windows",我也可以在我的 windows 10 笔记本电脑上运行 Linux 容器.它是如何实现的?我有一些疑问,我在这里遗漏了什么吗?

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

1) 我的机器是 Windows 10 有 Windows 内核.对吧?

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

2) 当我选择运行 Linux 容器的选项时,我认为 Linux 虚拟机运行在我的 Windows 10 机器之上,并且在该之上运行 Linux 容器.对吗?

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) 如果Linux VM 运行在Windows 机器的TOP 上,使用谁的内核?Linux VM 内核还是 Windows 10 内核?

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

4) 那么我们怎么能说容器不包含操作系统,对于 Windows,它们运行的​​是 Linux VM.

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

5) 现在如果我运行第二个容器,它会在已经运行的 Linux VM 之上运行,还是会再次启动新的 Linux VM?我认为它会在同一个正在运行的 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) 如果 Linux VM 在 Windows 机器的 TOP 上运行,那么我们是否可以像 Linux VM 的版本等一样控制正在运行的 Linux VM,或者它总是相同的,我们无法控制是吗?

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) 如果 Linux 虚拟机在 Windows 机器上运行,那么 Windows 资源对 Linux 虚拟机和容器不可见吗?如果它是可见的,那么 Linux 虚拟机如何与 Windows 主机通信?

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) 我的机器是Windows 10 有Windows Kernel.对吧?

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

答:是的.

2) 当我选择运行 Linux 容器的选项时,我认为 Linux 虚拟机运行在我的 Windows 10 机器之上,并且在该之上运行 Linux 容器.对吗?

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?

答:是的.一个名为 mobylinux 的 hyper-v linux 虚拟机将在那里,您可以在 hyper-v 管理器中看到它.

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

3) 如果Linux VM 运行在Windows 机器的TOP 上,使用谁的内核?Linux VM 内核还是 windows 10 内核?

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

A:hyper-v vm 使用 linux 内核.

A: The hyper-v vm use linux kernel.

4) 那么我们怎么能说容器不包含操作系统,对于 Windows,它们运行的​​是 Linux VM.

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

答:不确定您从哪里获得信息.docker 镜像只有文件系统,例如ubuntu16.04 文件系统,但没有内核.容器运行时会使用镜像文件系统&共享主机的内核(也许你只是说它没有自己的内核,所以你说它没有操作系统?)

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) 现在如果我运行第二个容器,它会在已经运行的 Linux VM 之上运行,还是会再次启动新的 Linux VM?我认为它会在同一个正在运行的 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.

A:是的,它会再次在同一个 linux 虚拟机上运行.

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

6) 如果 Linux VM 在 Windows 机器的 TOP 上运行,那么我们是否可以像 Linux VM 的版本等一样控制正在运行的 Linux VM,或者它总是相同的,我们无法控制是吗?

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?

答:不,请参阅此 讨论,好像不能ssh到vm,只是访问vm的文件系统的一些解决方法,所以没有找到任何方法来改变内核或linux发行版.

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) 如果 Linux 虚拟机在 Windows 机器上运行,那么 Windows 资源对 Linux 虚拟机和容器不可见吗?如果它是可见的,那么 Linux 虚拟机如何与 Windows 主机通信?

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:理论上,你可以将windows文件夹挂载到linux vm,然后容器可以使用linux文件夹和volume.docker for windows 已经帮您完成了,右键单击任务栏中的图标,您可以看到如下内容,就像图片一样:

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:

这篇关于docker desktop 如何在 Windows 机器上运行 linux 容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆