Docker and network mounted shares

  • I have a server whose shares are mounted on boot by LE.

    I want the data on these shares to be available to a docker container.

    So I have installed the docker addon and I am using portainer to configure my containers.

    So for eg. My Server has a share called Music which I mount to /storage/music on LE.

    From within Kodi/ LE the share can be accessed just fine after boot.

    But the same volume ie. /storage/music as accessed by portainer turns out blank (or displays a couple dummy folders I have planted inside the actual /storage/music folder)

    I think this happens because portainer or the emby docker which I wish to access the mounted share starts before the mounting takes place. Because if i restart when LE/ Koddi is running the network folders show up.

    Any way to delay the docker startup to accommodate the mounts?

    Thanks.

  • If you are able to see some directories inside that share but not the files then that looks to me like a permission problem.

    Check the permission flags that you have from within LE for the directory /storage/music where the share is mounted and also for the shared contents. If the directories are not at least 755 (drwxr-xr-x) that may be the problem since containers use uid=65534, gid=100.

    Alternatively you could try adding the docker parameter -v /storage/music:/music in the portainer setup or the addon's additional config page to mount that directory inside the container as /music, but I'm not sure if this will work with a mount point of a share instead of a directory in the filesystem.

    Alternatively you could also mount that same share again from within the container.

  • You did not say what method (nfs, smb, etc.) and you did not say how they are mounted (systemd?)

    If systemd, set its service to start before the docker service

    Also fyi, linuxserver does not recommend or support config files to reside on remote shares. Media folders however can be on remote shares.

  • aptalca , I am not placing config files on remote location. It is indeed media folders.

    Sorry, forgot to mention but I am using autostart to mount remote nfs volumes. System.d prolongs boot time if the remote server is down.

  • Sorry, forgot to mention but I am using autostart to mount remote nfs volumes.


    Then you could try hacking something like this using kodi's jsonrpc interface to disable and reenable the container. Not pretty but should work while a you look for a better solution.

    Although, I'm not sure if containers created with portainer could be restarted this way., may be you get an idea.

    /storage/.config/autostart.sh

    Code
    (
    <your mounts>
    
    sleep 10
    
    /storage/.config/addonctl.sh <docker.your_container_addon> stop
    <may need to add a delay here also>
    /storage/.config/addonctl.sh <docker.your_container_addon> start
    ) &

    /storage/.config/addonctl.sh

    Edited 4 times, last by librero: clarification (July 14, 2020 at 12:40 PM).

  • [user='138']

    Sorry, forgot to mention but I am using autostart to mount remote nfs volumes. System.d prolongs boot time if the remote server is down.

    It's either going to wait until remote paths are mounted, or it's going to start without them (as it does now). Can't have it both ways.

  • It's either going to wait until remote paths are mounted, or it's going to start without them (as it does now). Can't have it both ways.

    Well the autostart route does the job of ignoring any unavailable remote mounts a lot faster than systemd and proceeds to boot kodi, thats what I meant. The systemd holds up the boot process for nearly a minute.

    Anyway, what I need is to figure out some way for the portainer service to start up a little after kodi starts. Thats about it.