Post

Nextcloud

cloud storage platform that lets you store files.

Nextcloud

In this guide, we will deploy Nextcloud using Docker Compose with MariaDB as the database. This setup is simple, stable, and works well for home labs and self-hosted environments.


Requirements

  • Docker installed
  • Docker Compose installed
  • Server running Linux (Ubuntu recommended)

Docker Compose File

Create a new directory

1
2
mkdir nextcloud
cd nextcloud

Create the docker-compose.yml file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
services:
  db:
    image: mariadb:10.6
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=nextcloud
      - MYSQL_PASSWORD=nextcloud
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: unless-stopped
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=nextcloud
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
    ports:
      - 8080:80

volumes:
  nextcloud:
  db:

Start the Containers

1
docker-compose up -d

Once started, open Nextcloud in your browser http://YOUR-SERVER-IP:8080

Complete the web installation interface.

Using occ Command (Optional)

1
docker exec -u www-data nextcloud-app-1 ./occ

Conclusion

You now have a fully functional Nextcloud instance running with Docker Compose. You can optionally place it behind a reverse proxy like Nginx Proxy Manager or Traefik to enable HTTPS and domain access.

This post is licensed under CC BY 4.0 by the author.