Docker mount bind maps to unknown host directory

151 Views Asked by At

I have been running jellyfin in a docker container for some time. I'm using a USB-Drive to store media files and bind-mount this drive into the container so that jellyfin can access them.

Now I'm starting to run out of storage. So I was trying to add a second USB-Drive to increase storage capacity. However I can't manage to mount the second drive in a way that jellyfin can access it.

Initially I build the container with this run command:

`sudo docker run -d \
--name jellyfin \
--volume jellyfin-config:/config \
--volume jellyfin-cache:/cache \
--mount type=bind,source=/media/Media,target=/media \
--mount type=bind,source=/media2/Media,target=/media2 \
--restart=unless-stopped \
-p 8096:8096 \
jellyfin/jellyfin`

This failed with the error that "'/media2/Media' does not exist". The terminal however easily confirmed that it does:

felix@homeserver:~$ ls /media/Media
 Anime  Serien
felix@homeserver:~$ ls /media2/Media
 Filme  'Filme old'  'Stand-Up Comedy'

After tinkering around with using -v instead of --mount with no success, the above run command does not throw that error anymore but instead creates a container successfully. I assume run with -v created the directory (which is one of the differences between -v and --mount as I understand), but I have no idea where, since the initial folder is unchanged. If I connect to bash inside the container I can see that /media is mapped to the intended directory showing subfolders "Anime" and "Serien". /media2 however appears empty.

I have tried creating a new file in the mounted directory by running touch test.txt but I can not find this file on the host system.

docker inspect on the container shows these Mounts:

"Mounts": [
            {
                "Type": "volume",
                "Name": "jellyfin-cache",
                "Source": "/var/snap/docker/common/var-lib-docker/volumes/jellyfin-cache/_data",
                "Destination": "/cache",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "volume",
                "Name": "jellyfin-config",
                "Source": "/var/snap/docker/common/var-lib-docker/volumes/jellyfin-config/_data",
                "Destination": "/config",
                "Driver": "local",
                "Mode": "z",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "/media/Media",
                "Destination": "/media",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/media2/Media",
                "Destination": "/media2",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],

Folder permissions are also identical:

felix@homeserver:~$ ls -la /media/Media
total 12
drwxrwxrwx 1 root root    0 Sep 11 19:02 .
drwxrwxrwx 1 root root 4096 Sep 11 14:23 ..
drwxrwxrwx 1 root root 4096 Sep 11 14:21 Anime
drwxrwxrwx 1 root root 4096 Sep 12 03:23 Serien
felix@homeserver:~$ ls -la /media2/Media
total 76
drwxrwxrwx 1 root root     0 Sep 11 19:09  .
drwxrwxrwx 1 root root  4096 Sep 11 19:06  ..
drwxrwxrwx 1 root root 28672 Sep 12 01:30  Filme
drwxrwxrwx 1 root root 40960 Sep 12 01:54 'Filme old'
drwxrwxrwx 1 root root  4096 Sep 11 19:25 'Stand-Up Comedy'

I do not understand why one mount does work and the other does not.

0

There are 0 best solutions below