Raspbian Doker volume on usb Error "attempt to write a readonly database" when adding adlist

Running pihole on docker Docker version 26.0.0, build 2ae903e
Raspbian *debian 11.
The raspberry is mounting an usb disk ext4 where is locate the folder with docker compose and local volumes:

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:2024.02.2
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    environment:
      WEBPASSWORD: ${WEBPASSWORD}
      FTLCONF_LOCAL_IPV4: ${HOST_IP_V4_ADDRESS} # <-- match ipv4_address of host
      TZ: ${TIMEZONE}
      PIHOLE_DNS_: 127.0.0.1#5335
      DNSSEC: true
      DNSMASQ_LISTENING: "all"
      PIHOLE_DOMAIN: "lan"
      DNSMASQ_USER: "root"
      CUSTOM_CACHE_SIZE: "10000"
      DHCP_ACTIVE: "true"
      DHCP_IPv6: "false"
      IPv6: "false"
      DHCP_START: "192.168.1.50"
      DHCP_END: "192.168.1.100"
      DHCP_ROUTER: "192.168.1.254"
      DHCP_LEASETIME: "24"
      DHCP_rapid_commit: "true"
      DNS_BOGUS_PRIV: "true"
      DNS_FQDN_REQUIRED: "true"

    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed

Unbdound is installed directly on raspbian.
debug token is: https://tricorder.pi-hole.net/OumDYNgF/
already tried without success:
docker exec pihole chown -R www-data:pihole /etc/pihole
still having issue after restarting container service. Any suggestion?

The uploaded debug log is empty.

Can you please generate a new one?

sorry for delay, I could not get the log before than now https://tricorder.pi-hole.net/wsF6X6IR/
I don't know why the log is still empty, but i checked the issues..

2024-03-27 19:22:41: server.c.1513) server started (lighttpd/1.4.59)
2024-03-27 19:22:41: gw_backend.c.475) unlink /run/lighttpd/pihole-php-fastcgi.socket-0 after connect failed: Connection refused
2024-03-27 19:23:15: mod_fastcgi.c.487) FastCGI-stderr:PHP Warning:  SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /var/www/html/admin/scripts/pi-hole/php/groups.php on line 947

but permissions seems to be ok when i get them from inside the container:

# ls -altr *.db
-rw-r--r-- 1 pihole pihole    98304 Mar 27 19:20 gravity_old.db
-rw-r--r-- 1 pihole pihole    98304 Mar 27 19:22 gravity.db
-rw-rw-r-- 1 pihole pihole 18751488 Mar 31 00:04 pihole-FTL.db
*** [ DIAGNOSING ]: Pi-hole diagnosis messages
   count   last timestamp       type                  message                                                       blob1                 blob2                 blob3                 blob4                 blob5               
   ------  -------------------  --------------------  ------------------------------------------------------------  --------------------  --------------------  --------------------  --------------------  --------------------
   1       2024-03-30 22:43:49  DNSMASQ_WARN          no address range available for DHCP request via docker0     

-----tail of FTL.log------
   [2024-03-28 19:22:59.045 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-28 19:27:24.751 120M] Resizing "FTL-dns-cache" from 20480 to (1536 * 16) == 24576 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-28 20:33:06.222 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-28 21:38:04.487 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-28 22:37:24.370 120M] Resizing "FTL-dns-cache" from 24576 to (1792 * 16) == 28672 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-29 00:44:23.287 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-29 01:49:12.451 120M] Resizing "FTL-dns-cache" from 28672 to (2048 * 16) == 32768 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-29 05:47:00.297 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-29 19:01:14.805 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-29 19:11:11.515 120M] Resizing "FTL-dns-cache" from 32768 to (2304 * 16) == 36864 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-29 19:18:08.432 120M] Resizing "FTL-domains" from 61440 to (3072 * 24) == 73728 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-29 19:24:57.372 120M] Resizing "FTL-dns-cache" from 36864 to (2560 * 16) == 40960 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-29 19:47:31.887 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-29 21:00:49.533 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-29 22:20:05.925 120M] Resizing "FTL-dns-cache" from 40960 to (2816 * 16) == 45056 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-30 10:46:45.404 120M] Resizing "FTL-dns-cache" from 45056 to (3072 * 16) == 49152 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-30 12:16:48.720 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 13:18:05.756 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 14:13:31.336 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 17:40:34.944 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 18:11:01.285 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 19:23:49.622 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 20:41:22.299 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 21:00:11.269 120M] Resizing "FTL-domains" from 73728 to (3584 * 24) == 86016 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-30 21:51:11.841 120M] Resizing "FTL-dns-cache" from 49152 to (3328 * 16) == 53248 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-30 21:53:06.695 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 21:54:25.826 120M] Resizing "FTL-strings" from 122880 to (163840 * 1) == 163840 (/dev/shm: 1.8MB used, 67.1MB total, FTL uses 1.8MB)
   [2024-03-30 22:14:31.434 120M] Resizing "FTL-dns-cache" from 53248 to (3584 * 16) == 57344 (/dev/shm: 1.9MB used, 67.1MB total, FTL uses 1.9MB)
   [2024-03-30 22:47:31.884 120M] Resizing "FTL-dns-cache" from 57344 to (3840 * 16) == 61440 (/dev/shm: 1.9MB used, 67.1MB total, FTL uses 1.9MB)
   [2024-03-30 23:31:38.540 120M] Resizing "FTL-dns-cache" from 61440 to (4096 * 16) == 65536 (/dev/shm: 1.9MB used, 67.1MB total, FTL uses 1.9MB)
   [2024-03-30 23:34:12.323 120M] ***** Ignored unknown DNSSEC status "TRUNCATED"
   [2024-03-30 23:43:48.987 120M] WARNING in dnsmasq core: no address range available for DHCP request via docker0
   [2024-03-30 23:44:01.054 120/T145] ERROR: SQL query "END TRANSACTION" failed: database is locked (SQLITE_BUSY)
   [2024-03-30 23:44:01.055 120/T145] END TRANSACTION failed when trying to store queries to long-term database
   [2024-03-30 23:44:01.055 120/T145] Keeping queries in memory for later new attempt

As a test, can you try to start the container without volumes? Does it work without volumes?

testing without volumes had success.
I moved the compose file to a new path and repeated the configuration for adlists.
You could consider to allow to set an environment variable also for adlist in order to keep completely portable the docker-compose file.
thank you.

Did you perhaps manually create the volume directories before you started your Pi-hole container for the first time?

That could explain your observation, as permissions may have been wrong then.

It's usually safer to just add the volume definitions to your docker-compose or docker run script, leaving it to Docker to handle directory creation upon first run.

Correct. I created the dirs by myself. Thank you