docker 容器是否与主机 OS 完全隔离?

Are docker containers totally isolated from the host machine OS?

当我与人交谈和阅读有关容器的文章时,我听到的定义是 docker 容器彼此隔离,也与主机隔离。

不过我想问一下,在那种情况下,隔离级别到底是什么,是完全与主机或其 OS 隔离,还是有一些共享资源?如果是完全隔离的,怎么会这么小和轻?

docker 容器使用主机操作系统(内核),您可以从主机角度查看容器内部。 通常容器看不到主机进程或其他容器。

将容器想象成一个独立的应用程序进程运行,而不是虚拟机。

@Thomas 是对的,但我想扩展一下他的回答。

A Docker container is just a process / service that runs directly on your machine. It is slightly different than a regular process because the Docker daemon along with the Linux kernel do a few things to ensure it runs in total isolation.

正如@Thomas 已经提到的,它们不是虚拟机。如需更深入(但简短)的阅读,我推荐这篇文章:Comparing Virtual Machines vs Docker Containers.

这是一个社区 wiki 答案,用于提供有关此主题的更多信息。

如果有帮助,请告诉我。