barcodebuddy-docker icon indicating copy to clipboard operation
barcodebuddy-docker copied to clipboard

`chown /app/bbuddy/data: operation not permitted` when `/config` is mounted in via NFS

Open PyroDevil opened this issue 1 year ago • 0 comments

For many of my apps, (grocy inclusive) I use NFS mounts to mount in the /config directory.

This works fine normally, when the target directory is owned by the same UID/GID as mentioned in the PUID and GUID variables. On the NFS server side, I also map all users to that UID/GID via NFS.

Barcodebuddy could successfully create the data and keys directory, so the permissions are correct, but fails to chown /app/bbuddy/data:

barcodebuddy-1  | Barcode Buddy supervisor started
barcodebuddy-1  |
barcodebuddy-1  | Initialising container
barcodebuddy-1  | 2024/09/18 17:36:38 chown /app/bbuddy/data: operation not permitted
barcodebuddy-1 exited with code 0

This is the section from my docker compose yaml, that relates to barcode buddy:

services:
[...]
  barcodebuddy:
    image: f0rc3/barcodebuddy:latest
    restart: unless-stopped
    volumes:
      #- $BASE_APP_CFG_DIR/barcodebuddy:/config # Test without NFS works fine
      - type: volume
        source: barcodebuddy-config
        target: /config
        volume:
          nocopy: true
    environment:
      - PUID=568
      - PGID=568
      - TZ=$TZ
      - BBUDDY_EXTERNAL_GROCY_URL=https://$HOST_GROCY
    labels:
      - traefik.enable=true
      - traefik.http.routers.barcodebuddy-rtr.rule=Host(`$HOST_BARCODEBUDDY`)
      - traefik.http.routers.barcodebuddy-rtr.entrypoints=websecure
      - traefik.http.routers.barcodebuddy-rtr.service=barcodebuddy-svc
      - traefik.http.routers.barcodebuddy-rtr.middlewares=chain-no-auth@file
      - traefik.http.services.barcodebuddy-svc.loadbalancer.server.port=80
      - homepage.group=Utils
      - homepage.name=Barcode Buddy
      - homepage.href=https://$HOST_BARCODEBUDDY
    networks:
      docker_network: {}
      outside: {}
[...]
volumes:
  barcodebuddy-config:
    driver_opts:
      type: "nfs"
      o: $BARCODEBUDDY_NFS_OPTS_CONFIG
      device: $BARCODEBUDDY_NFS_DEVICE_CONFIG

.env file:

TZ=UTC
BASE_APP_CFG_DIR=/mnt/apps-config/cfgs
HOST_BARCODEBUDDY=barcodebuddy.example.org
BARCODEBUDDY_NFS_OPTS_CONFIG="addr=172.30.250.1,rw"
BARCODEBUDDY_NFS_DEVICE_CONFIG=":/mnt/data/apps-config/barcodebuddy"
$ pwd
/mnt/data/apps-config/barcodebuddy
$ ls -aln
total 76
drwxrwxr-x  4 568 568  4 Sep 18 17:34 .
drwxr-xr-x 18 568 568 18 Sep 18 17:32 ..
drwxr-xr-x  2 568 568  2 Sep 18 17:34 data
drwxr-xr-x  2 568 568  2 Sep 18 17:34 keys
$ cat /etc/exports
[...]
"/mnt/data/apps-config/barcodebuddy"\
        localhost(sec=sys,rw,anonuid=568,anongid=568,all_squash,no_subtree_check)\
        172.30.250.10(sec=sys,rw,anonuid=568,anongid=568,all_squash,no_subtree_check)
[...]

PyroDevil avatar Sep 18 '24 16:09 PyroDevil