如何解决在docker compose的容器之间共享FUSE挂载,而不会在主机上持久保留任何内容
在容器共享FS时如何在容器之间共享卷是非常简单的,但是当一个端点的目标目录不仅具有不同的FS,而且在容器运行后该FS也会更改时,它变得更加复杂。一个人想要复制它(ro模式)。
重要的一点是共享卷不应该不存储在主机上。它应该只在容器之间“存在”,而不是持久的。
无效下面的代码片段无法正常工作,只是让我对我要实现的目标有所了解(请参阅评论)。
version: '3.7'
services:
# This service spins up with /mnt being an empty,unmounted dir.
# It then runs an executable that will mount a FUSE filesystem
# under /mnt
app:
# application
volumes:
- type: bind
source: shared_mnt
target: /mnt
bind:
propagation: shared
privileged: true
devices:
- '/dev/fuse'
# This service wants to read (read-only) the contents of this
# FUSE fs from `app` service,thus it should act as a slave
nginx:
# nginx
volumes:
- type: bind
source: shared_mnt
target: /whateve # a read-only replica of `app`'s /mnt dir (does not have to be a fuse FS)
bind:
propagation: shared
volumes:
shared_mnt:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。