Docker: mounting a network share

Zululander

New Member
Joined
Apr 24, 2024
Messages
28
Reaction score
5
Credits
248
I am running Contatiner Station on a QNAP and wanting to use it to host a JellyFin app.

From googling, the docker compose file would be

YAML:
services:
    jellyfin:
        volumes:
            - /srv/jellyfin/config:/config
            - /srv/jellyfin/cache:/cache
            - /media:/media
        network_mode: host
        image: jellyfin/jellyfin:latest

I have a share that I am wanting to use for /srv/jellyfin and /media (they should all point to folders in //192.168.1.1/media /mnt/jellyfindata

If even possible, I am not sure how to use docker to first mount the share, which on a linux box I mount using:

Code:
//192.168.1.1/media /mnt/jellyfindata cifs  id=dmin,gid=admin,credentials=/etc/cred/jellyfinshare,_netdev 0 0

And then do I simply do something like

YAML:
services:
    jellyfin:
        volumes:
            - /192.168.1.1/media /mnt/jellyfindata/config:/config
            - /192.168.1.1/media /mnt/jellyfindata/cache:/cache
            - /192.168.1.1/media /mnt/jellyfindata/media:/media
        network_mode: host
        image: jellyfin/jellyfin:latest
 


No, in your docker compose you need to mount the local mount point, not the remote directly.

In your case, you shall mount /mnt/jellyfindata. Remove the "/192.168.1.1/media ", it'd be like this:

YAML:
services:
    jellyfin:
        volumes:
            - /mnt/jellyfindata/config:/config
            - /mnt/jellyfindata/cache:/cache
            - /mnt/jellyfindata/media:/media
        network_mode: host
        image: jellyfin/jellyfin:latest

This is how I have my nextcloud, I work on a remote filesystem through a local mount.

One thing you need to make sure is that, whenever you reboot your docker host (the machine where you mount those remotes), make sure docker starts after the operating system mounts the remote filesystems. This should happen by default, but for example if the power goes down and you need to manually power on the machines, you'll need to make sure that the machines serving the remote filesystems boot and are ready before the docker host starts dockering.

Otherwise, jellyfin will start using the local directory without the mount (empty), and the mount will fail because it will find the local directory busy with a lock.
 
Last edited:


Members online


Latest posts

Top