如何删除 swarm 集群中的卷?
How to delete volumes in swarm cluster?
我有一个带有一个管理器和另一个普通节点的 swarm 集群,当我创建一个 swarm 服务时,我正在使用挂载类型、挂载源和挂载目标创建。它在管理器和节点中创建具有相同名称的卷并启动容器并且我的服务启动了。
当我发布服务时,随服务创建的卷并没有被删除,这仍然可以。
我面临的问题是,当我删除具有相同端点的卷时,它只会删除 swarm 管理器中的卷,创建服务时在节点中创建的卷仍然存在。
我希望管理员删除所有随 swarm 服务创建的卷。有办法吗??
经过这么多的分析,这里是理论。
如果您指示 swarm 使用卷创建服务,Swarm 只会在集群内创建服务时执行操作,即在多个节点上是的,当您发送卷详细信息时是的,它也会创建卷,但是发布服务时,它无法检查工作节点是否存在卷,同时发布它的错误 docker
我已经在 docker 中提出了它的错误。
到目前为止,除了在释放 swarm 服务后从工作节点手动释放卷之外,没有其他方法。
据我所知,卷仅在创建容器的节点上创建。您的服务是否有可能无法在一个节点上启动,最终在另一个节点上结束,并且以某种方式 swarm 无法清理?如果是这样,请在 github.
中写一个问题
更新(来自评论):
根据 docker service create documentation:
A named volume is a mechanism for decoupling persistent data needed by your container from the image used to create the container and from the host machine. Named volumes are created and managed by Docker, and a named volume persists even when no container is currently using it. Data in named volumes can be shared between a container and the host machine, as well as between multiple containers. Docker uses a volume driver to create, manage, and mount volumes. You can back up or restore volumes using Docker commands.
因此,如果您使用的是命名卷,那么正确的答案是为什么它们在管理器上被删除以及它们在那里创建的位置?
我有一个带有一个管理器和另一个普通节点的 swarm 集群,当我创建一个 swarm 服务时,我正在使用挂载类型、挂载源和挂载目标创建。它在管理器和节点中创建具有相同名称的卷并启动容器并且我的服务启动了。
当我发布服务时,随服务创建的卷并没有被删除,这仍然可以。
我面临的问题是,当我删除具有相同端点的卷时,它只会删除 swarm 管理器中的卷,创建服务时在节点中创建的卷仍然存在。
我希望管理员删除所有随 swarm 服务创建的卷。有办法吗??
经过这么多的分析,这里是理论。
如果您指示 swarm 使用卷创建服务,Swarm 只会在集群内创建服务时执行操作,即在多个节点上是的,当您发送卷详细信息时是的,它也会创建卷,但是发布服务时,它无法检查工作节点是否存在卷,同时发布它的错误 docker
我已经在 docker 中提出了它的错误。
到目前为止,除了在释放 swarm 服务后从工作节点手动释放卷之外,没有其他方法。
据我所知,卷仅在创建容器的节点上创建。您的服务是否有可能无法在一个节点上启动,最终在另一个节点上结束,并且以某种方式 swarm 无法清理?如果是这样,请在 github.
中写一个问题更新(来自评论):
根据 docker service create documentation:
A named volume is a mechanism for decoupling persistent data needed by your container from the image used to create the container and from the host machine. Named volumes are created and managed by Docker, and a named volume persists even when no container is currently using it. Data in named volumes can be shared between a container and the host machine, as well as between multiple containers. Docker uses a volume driver to create, manage, and mount volumes. You can back up or restore volumes using Docker commands.
因此,如果您使用的是命名卷,那么正确的答案是为什么它们在管理器上被删除以及它们在那里创建的位置?