How to run the vfs/refresh command after mounting on docker

Ok, I just did it this way and worked fine, in case someone else is in the same situation:

for the mount container I added hostname: vault as part of the container definition, the --rc flags shown in the command are the only ones I had previously:


rclone-vault:
    image: rclone/rclone:1.56
    container_name: rclone-vault
    hostname: vault
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    volumes:
      - type: bind
        source: ${PATH_MOUNT_RCLONE}
        target: /data
        bind:
          propagation: shared
      - /etc/passwd:/etc/passwd:ro
      - /etc/group:/etc/group:ro
      - ${PATH_RCLONE}:/config/rclone
      - ${PATH_CACHE_RCLONE}:/cache
    privileged: true
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    security_opt:
      - apparmor:unconfined
    command: "mount VaultCrypt: /data --allow-other --rc --rc-addr :5572 --rc-no-auth ...etc"



then, created a new container reusing the rclone/rclone image, used the hostname previously specified with the flag
--rc-addr=vault:5572.
I initially tried this three ways:

--rc-addr=:5572
--rc-addr=localhost:5572
--rc-addr=127.0.0.1:5572

neither of them worked, but again I know very little of docker, I know there must be a much better way of doing this, this container did it fine.

rclone-vault-vfsrefresh:
    image: rclone/rclone:1.56
    container_name: rclone-vault-vfsrefresh
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TZ}
    volumes:
      - /etc/passwd:/etc/passwd:ro
      - /etc/group:/etc/group:ro
      - ${PATH_RCLONE}:/config/rclone
    privileged: true
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    security_opt:
      - apparmor:unconfined
    command: "rc vfs/refresh recursive=true 'dir=Media/' --rc-addr=vault:5572"
    depends_on:
      - <whatever container you want to make sure is started after your mount>

at the end you can check your logs for confirmation, I see them like this in Portainer: