Docker 卷的可访问性

Accessibility in Docker volumes

我正在阅读来自 Microsoft 的 document,其中说明了 Docker 卷

Volumes are stored within directories on the host filesystem. Docker will mount and manage the volumes in the container. Once mounted, these volumes are isolated from the host machine.

Multiple containers can simultaneously use the same volumes. Volumes also don't get removed automatically when a container stops using the volume.

In our example, we can create a directory on our container host and mount this volume into the container when we create the tracking portal container. When our tracking portal logs data, we can access this information via the container host's filesystem. We'll have access to this log file even if our container is removed.

我很困惑,因为我知道这些卷是与主机隔离的,但如果我们可以通过主机访问数据,那怎么可能呢。

我对 Windows 上的 Docker 不太熟悉,但我确定在这方面它可能与 Linux 相同...

Docker 卷在主机文件系统上具有特定权限的特定位置(即通过命名空间)“在主机上隔离”。具有更高权限的 Users/accounts 仍将被授予对那些 directories/files.

的访问权限

相比之下,可以对主机文件系统上的(几乎)任何目录进行绑定安装。