Docker数据卷定义和类型

6080阅读 0评论2019-07-19 forgaoqiang
分类:LINUX

Definition of: volume
A volume is a specially-designated directory within one or more containers that bypasses the Union File System. Volumes are designed to persist data, independent of the container’s life cycle. Docker therefore never automatically delete volumes when you remove a container, nor will it “garbage collect” volumes that are no longer referenced by a container. Also known as: data volume

数据卷是一个或多个容器中专门指定的目录,它能够绕过联合文件系统。卷被设计用作数据持久化、并且是独立于容器的生命周期的。因此,Docker不会在删除容器时自动删除数据卷卷,也不会主动“垃圾回收”掉容器不再使用的卷。

There are three types of volumes: host, anonymous, and named:
A host volume lives on the Docker host’s filesystem and can be accessed from within the container.
A named volume is a volume which Docker manages where on disk the volume is created, but it is given a name.

An anonymous volume is similar to a named volume, however, it can be difficult, to refer to the same volume over time when it is an anonymous volumes. Docker handle where the files are stored.

有三种数据卷类型:
①宿主机数据卷:直接在宿主机的文件系统中但是容器可以访问(bind mount)
②命名的数据卷:磁盘上Docker管理的数据卷,但是这个卷有个名字。
③匿名数据卷:磁盘上Docker管理的数据卷,因为没有名字想要找到不容易,Docker来管理这些文件。

备注:数据卷其实都在(如果没有网络文件系统等情况下)宿主机文件系统里面的,只是第一种是在宿主机内的特定目录下,而后两种则在docker管理的目录下,这个目录一般是 /var/lib/docker/volumes/。

上一篇:又一个黑客redis脚本分析
下一篇:没有了