Upgrade using Docker errors out with General error: 1018 Can't read dir of './nextcloud/' (errno: 13 "Permission denied")

Recently pulled the latest docker image and am getting this error trying to update from the homescreen.

Preparing update

Set log level to debug

Turned on maintenance mode

Repair step: Repair MySQL collation

Repair info: All tables already have the correct collation -> nothing to do

Repair step: Repair SQLite autoincrement

Repair step: Copy data from accounts table when migrating from ownCloud

OC\DB\Exceptions\DbalException: An exception occurred while executing a query: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1018 Can't read dir of './nextcloud/' (errno: 13 "Permission denied")

I tried changing permissions, but no luck:

chown -R www-data:www-data /var/www/html/
chmod -R +rw /var/www/html/

I’m not sure where the ./nextcloud dir is supposed to be and what permissions it needs.

docker-compose.yml

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - /mnt/md0/nextclouddb:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<pwd>
      - MYSQL_PASSWORD=<pwd>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    build: .
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=<pwd>
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - NEXTCLOUD_OVERWRITEPROTOCOL=https

Dockerfile

FROM nextcloud

RUN apt update
RUN apt install ffmpeg imagemagick ghostscript -y

I have a feeling it’s because the external folder mnt/md0/nextclouddb is owned by root.