<p>I am bringing up a media server that reads media files from a mounted usb drive. The docker containers fail to write / change permissions of the files in the folders.</p>
<p>I have a USB drive mounted with given <code>/etc/fstab</code> file:</p>
<pre><code>$ cat /etc/fstab
...
UUID=XXX-YZZ        /mnt/usb1       vfat    nofail,umask=002,uid=1000,gid=docker 0 0
</code></pre>
<p>The docker compose file is as follows:</p>
<pre><code>services:
  plex-server:
    container_name: plex-server
    image: linuxserver/plex:latest
    restart: unless-stopped
    environment:
      - PUID=${PUID} # default user id, defined in .env
      - PGID=${PGID} # default group id, defined in .env
      - TZ=${TZ} # timezone, defined in .env
      - VERSION=docker
      - UMASK_SET=${UMASK}
    network_mode: host
    volumes:
      - ${ROOT}/config/plex/db:/config  # plex database
      - ${ROOT}/config/plex/transcode:/transcode  # temp transcoded files
      - ${ROOT}/complete:/data  # media library
</code></pre>
<p>The .env file has such variables defined in it:</p>
<pre><code>PUID=1000
PGID=991
UMASK=002
</code></pre>
<p>The GID is same as the docker group id:</p>
<pre><code>$ getent group docker | cut -d: -f3
991
</code></pre>
<p>Looking at the mounted drive permissions, it seems sufficient -</p>
<pre><code>pi@raspberrypi:~/rpi5/media-server-stack $ ls -alh /mnt/usb1/
total 100K
drwxrwxr-x 7 pi   docker  16K Jan  1  1970  .
drwxr-xr-x 3 root root   4.0K Aug 19 20:31  ..
drwxrwxr-x 3 pi   docker  16K Aug 20 19:37  xxx
</code></pre>
<p>Now when I try to bring up the docker it raises this issue:</p>
<pre><code>Error response from daemon: error while creating mount source path '/mnt/usb1/rpi5b/config/plex/db': chown /mnt/usb1/xxx/config/plex/db: operation not permitted
</code></pre>
<p>What could I be missing that it is unable chown the directory the docker creates itself?</p>
<p>I am suspecting if the type=vfat could be a problem and I should consider formatting it to ext4? I have a lot of data and don't want to experiment without getting an advice from others.</p>

CC BY-SA 4.0
2024-08-20T17:34:16.620Z
does adding `version: '3.2'` (or higher) to the top of the docker-compose.yml make a difference?
mikequentel
CC BY-SA 4.0
2024-08-21T11:51:36.930Z
no, it doesn't @mikequentel
CodeBlooded
<docker><docker-compose>
docker containers unable to access vfat mount
CodeBlooded
# docker containers unable to access vfat mount

(Asked by: username_0 on 2024-08-20)

I am bringing up a media server that reads media files from a mounted usb drive. The docker containers fail to write / change permissions of the files in the folders.
I have a USB drive mounted with given /etc/fstab file:
$ cat /etc/fstab
...
UUID=XXX-YZZ        /mnt/usb1       vfat    nofail,umask=002,uid=1000,gid=docker 0 0

The docker compose file is as follows:
services:
  plex-server:
    container_name: plex-server
    image: linuxserver/plex:latest
    restart: unless-stopped
    environment:
      - PUID=${PUID} # default user id, defined in .env
      - PGID=${PGID} # default group id, defined in .env
      - TZ=${TZ} # timezone, defined in .env
      - VERSION=docker
      - UMASK_SET=${UMASK}
    network_mode: host
    volumes:
      - ${ROOT}/config/plex/db:/config  # plex database
      - ${ROOT}/config/plex/transcode:/transcode  # temp transcoded files
      - ${ROOT}/complete:/data  # media library

The .env file has such variables defined in it:
PUID=1000
PGID=991
UMASK=002

The GID is same as the docker group id:
$ getent group docker | cut -d: -f3
991

Looking at the mounted drive permissions, it seems sufficient -
pi@raspberrypi:~/rpi5/media-server-stack $ ls -alh /mnt/usb1/
total 100K
drwxrwxr-x 7 pi   docker  16K Jan  1  1970  .
drwxr-xr-x 3 root root   4.0K Aug 19 20:31  ..
drwxrwxr-x 3 pi   docker  16K Aug 20 19:37  xxx

Now when I try to bring up the docker it raises this issue:
Error response from daemon: error while creating mount source path '/mnt/usb1/rpi5b/config/plex/db': chown /mnt/usb1/xxx/config/plex/db: operation not permitted

What could I be missing that it is unable chown the directory the docker creates itself?
I am suspecting if the type=vfat could be a problem and I should consider formatting it to ext4? I have a lot of data and don't want to experiment without getting an advice from others.

**Tags:** docker, docker-compose

> **Comments:**
> **username_1**: does adding `version: '3.2'` (or higher) to the top of the docker-compose.yml make a difference?  
> **username_0**: no, it doesn't @username_1  

---

## 0 answers

