Docker 如何在 macOS 主机下运行 Linux 内核? [英] How does Docker run a Linux kernel under macOS host?

查看:27
本文介绍了Docker 如何在 macOS 主机下运行 Linux 内核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 macOS Sierra 上安装了 Docker,如下所示.注意我没有安装 VirtualBox.

I installed Docker on my macOS Sierra as follows. Note I don't have VirtualBox installed.

brew cask uninstall virtualbox
brew cask install docker

我的 macOS 详细信息.

My macOS details.

$ uname -a
Darwin m-C02QG7TRG8WN.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

$ docker version
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Tue Mar 28 00:40:02 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:00:50 2017
 OS/Arch:      linux/amd64
 Experimental: true

一旦我从启动板运行 Docker,我就可以运行 Docker 容器了.

Once I run Docker from launchpad, I am able to run Docker containers.

$ docker run -it ubuntu
root@2351d4222a4e:/# uname -a
Linux 2351d4222a4e 4.9.13-moby #1 SMP Sat Mar 25 02:48:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

我的问题是 Docker 如何在 macOS 中运行 Linux 内核?我认为 Docker 至少需要运行 boot2docker 或其他类似的 Linux 内核,以便它可以在它的帮助下创建 Ubuntu 的文件系统.但是上面的输出似乎表明事实并非如此.那么Linux内核从何而来?

My question is how does Docker manage to run a Linux kernel within macOS? I thought Docker would at least require boot2docker or some other such Linux kernel running so that it can create the Ubuntu's filesystem with the help of it. But the above output seems to indicate that it is not so. Where does the Linux kernel come from then?

推荐答案

虽然其他关于虚拟机管理程序的答案是正确的,但它们没有回答您的具体问题.

While the other answers are correct about the hypervisor, they don't answer your specific question.

答案是Docker [Desktop] for Mac"确实运行 Linux 主机 VM 并替代 boot2docker - LinuxKit 由 Docker 开发和维护,目的是制作轻量级发行版.

The answer is "Docker [Desktop] for Mac" does run a Linux host VM with a replacement for boot2docker - LinuxKit developed and maintained by Docker for the purpose of making lightweight distributions.

https://blog.docker.com/2017/04/introducing-linuxkit-container-os-toolkit/

您看到的 uname 中没有关键字,但现在似乎已包含在内,例如来自 Docker for Mac 18.03.1 我看到:

The uname you saw didn't have the keyword in it, but it seems to be included now, e.g. from Docker for Mac 18.03.1 I see:

Linux a8e079429a51 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 Linux

您可以在发布页面上看到包含版本的链接.https://docs.docker.com/docker-for-mac/release-笔记/

You can see links to the included versions on the release pages. https://docs.docker.com/docker-for-mac/release-notes/

所以它与时代没有太大区别Docker Machine + VirtualBox + boot2docker

So it's not so different from the old days Docker Machine + VirtualBox + boot2docker,

对于新的日子,这只是配置由Docker [Desktop] for Mac"在内部完成和VirtualBox被苹果的Hyperkit取代,并且默认VM"有点隐藏.

for the new days, it's just the provisioning is done internally by "Docker [Desktop] for Mac" and VirtualBox is replaced by Apple's Hyperkit, and the "default VM" is a bit more tucked away.

这篇关于Docker 如何在 macOS 主机下运行 Linux 内核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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