Docker 数据卷容器 - 我可以跨 swarm 共享吗

Docker Data Volume Container - Can I share across swarm

我知道如何使用 --volumes-from 创建一个数据卷容器并将其挂载到多个其他容器,但我确实有几个关于它的用法和限制的问题:

情况:我希望使用数据卷容器来为我的网络应用程序存储用户上传的图像。这个数据量容器将被许多其他容器运行 web 前端used/mounted。

问题:

  1. 数据卷容器可以 used/mounted 在驻留在 docker 集群中其他主机上的容器中吗?

  2. 表现如何?是否建议以这种方式构建事物?

  3. 是否有更好的方法来处理跨容器和主机(如 NFS)共享持久性资源?

Can data volume containers be used/mounted in containers residing on other hosts within a docker swarm?

Docker 本身不提供任何在集群中的主机之间迁移数据或共享数据的工具。

How is the performance? is it recommended to structure things this way?

Docker 卷通常只带来很小的性能开销,因为它们只是绑定挂载。

Is there a better way to handle sharing of persistent resources across containers and hosts such as NFS?

NFS 或任何集群文件系统,例如 gluster,可用于创建可供集群中所有主机使用的数据卷。

容器迁移有一种技术叫做Flocker which will help you to move your containers across the hosts with the attached volume. Flocker is open source. Docker in itself doesn't provide any functionality for Docker container migration. There is a small article。希望它会有所帮助。