Written on 2. February 2022

Nextcloud with docker-compose

Install nextcloud in a docker enviroment with docker-compose.

Installation

Folders

To store the database, www-path, and the local data I’ll create some persistent locations.

mkdir /home/nextcloud/data -p
mkdir /home/nextcloud/mysql -p
mkdir /home/nextcloud/appdata -p

Docker-compose.yml

Create a docker-compose.yml in the root folder /home/nextcloud.

version: '3'

services:
  nextcloud_db:
    container_name: nextcloud_db
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    volumes:
      - /home/nextcloud/mysql:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: Str0ngSecret!
      MYSQL_PASSWORD: Str0ngSecret!
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud

  nextcloud:
    container_name: nextcloud
    image: lscr.io/linuxserver/nextcloud
    restart: always
    ports:
      - 444:443
    links:
      - nextcloud_db
    volumes:
      - /home/nextcloud/appdata:/config
      - /home/nextcloud/data:/data
    environment:
      MYSQL_PASSWORD: Str0ngSecret!
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_HOST: nextcloud_db

In this scenario I mapped the nextcloud container to the external Port :444. Feel free to change it!

Troubleshooting

LDAP Wizzard is not working

If the LDAP Wizzard is not working go to /home/nextcloud/appdata/www/nextcloud/apps/user_ldap/ajax. Here you have to add to every file in the 2nd line the following code.

require_once($_SERVER['DOCUMENT_ROOT'].'/lib/base.php');

2 Comments on Nextcloud with docker-compose

    • Do you mean the database selection during the install wizard? There is an option to choose if sqlite or MySQL/MariaDB should be used.

Leave a Reply

Your email address will not be published. Required fields are marked *