V5.8.1-buster: Readonly database errors

Hello,
I pulled the v5.8.1-buster (also tried :latest) pihole:pihole container using docker, and have been getting this error whenever I try to add something to any of the databases (adlist, groups, whitelist, etc.)

I have tried removing the docker image and the mapped volumes from my machine (eg, volumes:
- '/home/docker/pihole/etc-pihole/:/etc/pihole/'), but the error is the same.

The files in /etc-pihole are owned by root:root except for pihole-FTL.conf, which is 999:spi. (That maps to pihole:pihole in the container.) I have not changed any permissions or ownership. In the container, the pihole processes are owned by root. (eg, root -> pihole-FTL no-daemon). Lighttpd is owned by www-data.

In the docker container, /var/log/lighttpd/error.log contains:

2021-08-02 12:18:16: (server.c.1464) server started (lighttpd/1.4.53)

2021-08-02 12:18:16: (gw_backend.c.476) unlink /var/run/lighttpd/php.socket-0 after connect failed: Connection refused

2021-08-02 12:19:17: (mod_fastcgi.c.421) 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 90

Based on some other posts in the forum, I tried adding the pihole user to group www-data, but the error persists. Same thing if I try chmod 777 on the /etc/pihole directory.

/var/run/lighttpd/php.socket-0 is owned by www-data:www-data, srwxr-xr-x. chmod g+w does not eliminate the error either.

One update: if I use 'docker create volume pihole' instead of mounting a host directory, the permissions error goes away.

OK, based on this I decided this was still a permissions error on the host, not the container. Rather than do a chmod on the files in /etc/pihole (from the host), I chowned the enclosing folder and the error was resolved. I think the issue must have been that pihole needs not to just read/write existing files but create new ones, and didn't have write access to the directory.