Docker-compose mount visible from host but not container

What is the problem you are having with rclone?

Running docker compose to start rclone and sonarr.
Gdrive mount is accessible from host but empty when listing in sonarr container.

What is your rclone version (output from rclone version)

rclone v1.55.0

  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.2
  • go/linking: static
  • go/tags: none

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Vultr VPS,
Linux 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux

Which cloud storage system are you using? (eg Google Drive)

GDrive

docker-compose file

version: "3.7"
services:

  rclone_tv:
    image: rclone/rclone
    container_name: rclone_tv
    restart: unless-stopped
    environment:
      - PUID=1001
      - PGID=1001
    volumes:
      - /etc/passwd:/etc/passwd:ro
      - /etc/group:/etc/group:ro
      - /mnt:/data:shared
      - /var/lib/rclone-data/config:/config/rclone
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    security_opt:
      - apparmor:unconfined
    command: "mount gd-tv:   /data/gd-tv    --allow-other --transfers 1 --dir-cache-time 1000h --buffer-size 8M --log-file /data/logs/tv.log --log-level DEBUG"

  sonarr:
    image: ghcr.io/linuxserver/sonarr
    container_name: sonarr
    depends_on:
      - rclone_tv
    environment:
      - PUID=1001
      - PGID=1001
    volumes:
      - /var/lib/sonarr-data/config:/config
      - /mnt/rclone-tv:/tv
      - /mnt/scratch/downloads:/downloads
    ports:
      - 8989:8989
    restart: unless-stopped

The rclone config contents with secrets removed.

[gd]
type = drive
client_id = <obfuscated>.apps.googleusercontent.com
client_secret = <obfuscated>
scope = drive
root_folder_id =
service_account_file =
token = {"access_token":"<obfuscated>","token_type":"Bearer","refresh_token":"<obfuscated>","expiry":"2021-04-10T03:12:09.713963213Z"}

[gd-tv]
type = cache
remote = gd:Media/TV
plex_url =
plex_username =
plex_password =
chunk_size = 10M
info_age = 1h
chunk_total_size = 250M

A log from the command with the -vv flag

from host

ls /mnt/gd-tv/
11.22.63
+all the shows

and when trying to list content from the sonarr container fails, no errors, just nothing visibile

root@testvps1:~# docker exec -t sonarr ls /tv
root@testvps1:~#

and the debug log from the starting of the docker compose, the host ls. There are no log entries made when attempting to ls the mount from the container.

2021/04/10 03:11:24 DEBUG : Using config file from "/config/rclone/rclone.conf"
2021/04/10 03:11:24 DEBUG : rclone: Version "v1.55.0" starting with parameters ["rclone" "mount" "gd-tv:" "/data/gd-tv" "--allow-other" "--transfers" "1" "--dir-cache-time" "1000h" "--buffer-size" "8M" "--log-file" "/data/logs/tv.log" "--log-level" "DEBUG"]
2021/04/10 03:11:24 DEBUG : Creating backend with remote "gd-tv:"
2021/04/10 03:11:24 DEBUG : Creating backend with remote "gd:Media/TV"
2021/04/10 03:11:25 DEBUG : Google drive root 'Media/TV': root_folder_id = "<redacted>" - save this in the config to speed up startup
2021/04/10 03:11:27 DEBUG : gd-tv: wrapped gd:Media/TV at root
2021/04/10 03:11:27 INFO  : gd-tv: Cache DB path: /root/.cache/rclone/cache-backend/gd-tv.db
2021/04/10 03:11:27 INFO  : gd-tv: Cache chunk path: /root/.cache/rclone/cache-backend/gd-tv
2021/04/10 03:11:27 INFO  : gd-tv: Chunk Memory: true
2021/04/10 03:11:27 INFO  : gd-tv: Chunk Size: 10M
2021/04/10 03:11:27 INFO  : gd-tv: Chunk Total Size: 250M
2021/04/10 03:11:27 INFO  : gd-tv: Chunk Clean Interval: 1m0s
2021/04/10 03:11:27 INFO  : gd-tv: Workers: 4
2021/04/10 03:11:27 INFO  : gd-tv: File Age: 1h0m0s
2021/04/10 03:11:27 DEBUG : Adding path "cache/expire" to remote control registry
2021/04/10 03:11:27 DEBUG : Adding path "cache/stats" to remote control registry
2021/04/10 03:11:27 DEBUG : Adding path "cache/fetch" to remote control registry
2021/04/10 03:11:27 DEBUG : Cache remote gd-tv:: subscribing to ChangeNotify
2021/04/10 03:11:27 DEBUG : Cache remote gd-tv:: Mounting on "/data/gd-tv"
2021/04/10 03:11:27 DEBUG : : Root:
2021/04/10 03:11:27 DEBUG : : >Root: node=/, err=<nil>
2021/04/10 03:11:35 DEBUG : /: Attr:
2021/04/10 03:11:35 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxr-xr-x, err=<nil>
2021/04/10 03:11:36 DEBUG : /: ReadDirAll:
2021/04/10 03:11:36 DEBUG : Cache remote gd-tv:: list ''
2021/04/10 03:11:36 DEBUG : : list: error: missing cached dir:
2021/04/10 03:11:45 DEBUG : : list: read 397 from source
2021/04/10 03:11:45 DEBUG : : list: source entries: [all the TV shows]
2021/04/10 03:11:45 DEBUG : : list: cached directories: 397
2021/04/10 03:11:45 DEBUG : : list: cached dir: '', cache ts: 2021-04-10 03:11:45.262689141 +0000 UTC m=+20.364857943
2021/04/10 03:11:45 DEBUG : /: >ReadDirAll: item=399, err=<nil>

When I perform the mount on the host outside of the docker container through another service, I can list the mount contents in the sonarr container without problem, its only when trying to combine into one docker-compose file.
This is the systemd file used to verify this

[Unit]
Description=rclone mount for remote:/Media/TV
Requires=systemd-networkd.service
Wants=network-online.target
After=network-online.target

[Service]
SyslogIdentifier=rclone.service
Type=simple
ExecStart=/bin/rclone mount gd-tv: /mnt/rclone-tv \
                            --config /var/lib/rclone-data/config/rclone.conf \
                            --allow-other \
                            --transfers 1 \
                            --drive-chunk-size 8M \
                            --dir-cache-time 1000h \
                            --buffer-size=8M \
                            --log-file=/var/log/rclone-tv.log \
                            --log-level=DEBUG

ExecStop=/bin/fusermount -u -z /home/ianj/rclone-tv
Restart=always

[Install]
WantedBy=multi-user.target

I think it is something to do with this line and the bind propagation

Try rshared.

I've read those docs about 10 times and I still don't understand them!

Thanks Nick. I originally had rshared and as part of my 'wth, try all the random things' test strategy moved it back to shared. I retested rshared just now and it demonstrates the same failure.

You might need to put it on the sonarr mount too. Can you try that?

1 Like

Well that fixed it, thank you!

Final version for anyone else running into this

version: "3.7"
services:

  rclone_tv:
    image: rclone/rclone
    container_name: rclone_tv
    restart: unless-stopped
    environment:
      - PUID=1001
      - PGID=1001
    volumes:
      - /etc/passwd:/etc/passwd:ro
      - /etc/group:/etc/group:ro
      - /mnt:/data:rshared
      - /var/lib/rclone-data/config:/config/rclone
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    security_opt:
      - apparmor:unconfined
    command: "mount gd-tv:   /data/gd-tv    --allow-other --transfers 1 --dir-cache-time 1000h --buffer-size 8M --log-file /data/logs/tv.log --log-level DEBUG"

  sonarr:
    image: ghcr.io/linuxserver/sonarr
    container_name: sonarr
    depends_on:
      - rclone_tv
    environment:
      - PUID=1001
      - PGID=1001
    volumes:
      - /var/lib/sonarr-data/config:/config
      - /mnt/gd-tv:/tv:rshared
      - /mnt/scratch/downloads:/downloads
    ports:
      - 8989:8989
    restart: unless-stopped
1 Like

Great! Do you need :rshared or will :shared do? I'm not clear on the difference from reading the docs!

I needed rshared, shared didn’t work.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.