cweagans / docker-bg-sync

A container that syncs files between two configurable directories.
224 stars 39 forks source link

Can Multiple Containers Share One bg-sync service/mount point? #29

Open henrymazza opened 3 years ago

henrymazza commented 3 years ago

I assumed it could, but it only syncs to the first service specified in the volumes_from list. Plus: my containers won't share the same mount: with docker inspect shows that each one has a distinct mount point. Is it an intrinsic limitation or am I missing something in the configs?

services:
  web:
    working_dir: /app-sync
    volumes:
      - /app-sync

  spring:
    working_dir: /app-sync
    volumes:
      - /app-sync

  sidekiq:
    working_dir: /app-sync
    volumes:
      - /app-sync

  bg-sync:
    image: cweagans/bg-sync
    volumes:
      - .:/source
    volumes_from:
      - spring
      - web
      - sidekiq
    environment:
      - SYNC_DESTINATION=/app-sync
      - SYNC_MAX_INOTIFY_WATCHES=40000
      - SYNC_VERBOSE=1
    privileged: true
cweagans commented 3 years ago

I've never used it in this particular configuration, so I'm not sure if this will work or not. Generally speaking, it just syncs from one dir to another, so if there's some way of having a docker container with a volume at /foo, and have 1+ other containers all mount the volume from the first container, then there should be some way of getting this container to do what you want to do.

cweagans commented 3 years ago

(also, I haven't been spending much time on this lately -- https://mutagen.io/ has been a much nicer solution that isn't so touchy)