nextcloud dockerで構築時にエラー「Error while trying to initialise the database: 」が発生した場合の対処法

nextcloud dockerで構築時にエラー「Error while trying to initialise the database: 」が発生した場合の対処法

nextcloudを、dockerで構築時にエラー「Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE」が発生した場合の対処法を記述してます。

環境

  • nextcloud 22.2.0
  • docker 20.10.8
  • docker-compose 1.29.2

エラー全文

以下の「docker-compose.yml」で「docker-compose up -d」実行時に発生

version: '3'
services:
  app:
    container_name: app-server
    image: nextcloud:fpm
    restart: always
    expose:
      - '80'
      - '9000'
    volumes:
      - app_data:/var/www/html
  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - mysql_data:/var/lib/mysql
    ports:
      - 3309:3306
    environment:
      - MYSQL_ROOT_PASSWORD=pwd
      - MYSQL_PASSWORD=pwd
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
  onlyoffice-document-server:
    container_name: onlyoffice-document-server
    image: onlyoffice/documentserver:latest
    restart: always
    expose:
      - '80'
      - '443'
    volumes:
      - document_data:/var/www/onlyoffice/Data
      - document_log:/var/log/onlyoffice
  nginx:
    container_name: nginx-server
    image: nginx
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - app_data:/var/www/html
volumes:
  document_data:
  document_log:
  app_data:
  mysql_data:

エラー全文

Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE

対処法

「db」の「command」を以下に変更して、再度実行します。

  db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    restart: always
    volumes:
      - mysql_data:/var/lib/mysql
    ports:
      - 3309:3306
    environment:
      - MYSQL_ROOT_PASSWORD=pwd
      - MYSQL_PASSWORD=pwd
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud