问题描述
Docker Swarm可以管理两种类型的存储:
Docker Swarm can manage two types of storage:
卷
和 bind
虽然Docker Documentation不建议 bind
,因为它会在本地目录(在每个swarm节点上)到任务,没有提到 volume
实现,所以我不明白任务之间如何共享卷?
While bind
is not suggested by Docker Documentation since it creates a binding between a local directory (on each swarm Node) to a task, the volume
implementation is not mentioned, so I don't understand how volumes are shared between tasks?
- Docker Swarm如何在节点之间共享卷?
- 在哪里保存卷(在管理器上?还有更多)比一个管理员?)
- 如果节点运行在不同网络上的不同计算机上,节点之间是否没有问题?
- 是否创建VPN?
- How does Docker Swarm shares volumes between nodes?
- Where are volumes saved (on a manager? And if there is more than one manager?)
- Is there no problem between nodes if it's running on different machines on different networks?
- Does it create a VPN?
推荐答案
您要问的是一个常见问题。卷数据和该卷可以执行的功能由卷驱动程序管理。就像您可以使用其他网络驱动程序一样,例如 overlay
, bridge
或 host
,则可以使用不同的卷驱动程序。
What you're asking about is a common question. Volume data and the features of what that volume can do are managed by a volume driver. Just like you can use different network drivers like overlay
, bridge
, or host
, you can use different volume drivers.
Docker和Swarm仅随附标准的 local
驱动程序盒子外面。它不了解Swarm,它只会在计划您的服务任务的任何节点上为您的数据创建新卷。通常这不是您想要的。
Docker and Swarm only come with the standard local
driver out of the box. It doesn't have any awareness of Swarm, and it will just create new volumes for your data on whichever node your service tasks are scheduled on. This is usually not what you want.
您希望使用Swarm感知的第3方驱动程序插件,并确保您为服务任务创建的卷可用于在正确的时间正确的节点。选项包括使用 Docker for AWS / Azure及其随附的驱动程序,或流行的开源解决方案。
You want a 3rd party driver plugin that is Swarm aware, and will ensure the volume you created for a service task is available on the right node at the right time. Options include using "Docker for AWS/Azure" and its included CloudStor driver, or the popular open source REX-Ray solution.
有很多第三方音量驱动程序,您可以在。
There are lots of 3rd party volume drivers, which you can find on the Docker Store.
这篇关于Docker Swarm如何实现卷共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!