在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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...