Skip to content

xamayca/Nextcloud-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nextcloud Docker

License MIT Synology NAS Portainer Nextcloud MariaDB Adminer

Self-hosted Nextcloud instance using Docker Compose with MariaDB and Adminer, deployed on a Synology NAS.

Portainer containers


πŸ“‹ Table of Contents

Section Description
βš™οΈ PREREQUISITES Software requirements
πŸ“ REQUIRED DIRECTORIES Host directories to create
πŸš€ STACK OVERVIEW Services, ports and network
πŸ” ENVIRONMENT VARIABLES stack.env configuration
🚒 PORTAINER DEPLOYMENT Deploy via Portainer
πŸ—„οΈ BACKUP Volumes to back up
πŸ“„ LICENSE MIT License

βš™οΈ Prerequisites

  • 🐳 Docker installed on your host machine
  • 🚒 Portainer (recommended for deployment via Git)
  • πŸ“ Access to your host machine to create directories (via SSH or file manager)

πŸ“ Required Directories

Create the following directories on your host before deploying:

mkdir -p /volume1/docker/nextcloud/custom_apps
mkdir -p /volume1/docker/nextcloud/config
mkdir -p /volume1/docker/nextcloud/data
mkdir -p /volume1/docker/nextcloud/themes

Note

Paths above are configured for Synology NAS. Adjust the NEXTCLOUD_HOST_* variables in Portainer to match your host environment.


πŸš€ Stack Overview

Three services orchestrated via Docker Compose, communicating through a shared bridge network.

Service Image Container Container Port Host Port Network Depends On Description
mariadb mariadb:latest nextcloud-mariadb 3306 β€” backend-nextcloud β€” Database server
adminer adminer:latest nextcloud-adminer 8080 8081 backend-nextcloud mariadb Database administration interface
nextcloud nextcloud:latest nextcloud 80 8443 backend-nextcloud mariadb File hosting and collaboration platform

Note

The Nextcloud image includes an Apache web server β€” no separate web server container is needed.


πŸ” Environment Variables

All variables must be provided via stack.env or manually in the Portainer stack environment section.

Variable Description Required
MYSQL_DATABASE Database name βœ…
MYSQL_USER Database username βœ…
MYSQL_PASSWORD Database password βœ…
MYSQL_ROOT_PASSWORD Database root password βœ…
NEXTCLOUD_ADMIN_USER Nextcloud admin username β€” configuration still being evaluated ❌
NEXTCLOUD_ADMIN_PASSWORD Nextcloud admin password β€” configuration still being evaluated ❌
NEXTCLOUD_TRUSTED_DOMAINS Allowed domains (space-separated) β€” configuration still being evaluated ❌
NEXTCLOUD_THEME_DIR_NAME Nextcloud theme directory name ❌
ADMINER_DESIGN Adminer UI theme (e.g. dracula) ❌
NEXTCLOUD_HOST_CUSTOM_APPS_DIR Host path for custom apps βœ…
NEXTCLOUD_HOST_CONFIG_DIR Host path for config βœ…
NEXTCLOUD_HOST_DATA_DIR Host path for user data βœ…
NEXTCLOUD_HOST_THEMES_DIR Host path for themes βœ…

Tip

If NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD are not set, the admin account will be created manually on first login.


🚒 Portainer Deployment

Deploy this stack via Portainer using the Git repository integration.

Step 1 β€” Create the stack

  • Open Portainer β†’ Stacks β†’ Add stack
  • Select Repository
  • Set the following fields:
Field Value
Repository URL https://github.com/xamayca/Nextcloud-docker
Compose path compose.yaml

Step 2 β€” Enable automatic updates (optional)

Enable GitOps updates to automatically redeploy when changes are detected in the Git repository.

Warning

GitOps updates may override any manual configuration changes.

Step 3 β€” Configure environment variables

Option A β€” Import file Download stack.env from the repository and import it directly into Portainer.

Option B β€” Manual setup Copy the variables into the Advanced environment variables section.

Step 4 β€” Pre-deploy checklist

Important

Verify the following before deploying.

Database β€” required, MariaDB will not start without these

  • MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD, MYSQL_ROOT_PASSWORD are all set

Bind mount paths β€” directories must exist on the host before deploying

  • NEXTCLOUD_HOST_CUSTOM_APPS_DIR β€” e.g. /path/to/nextcloud/custom_apps
  • NEXTCLOUD_HOST_CONFIG_DIR β€” e.g. /path/to/nextcloud/config
  • NEXTCLOUD_HOST_DATA_DIR β€” e.g. /path/to/nextcloud/data
  • NEXTCLOUD_HOST_THEMES_DIR β€” e.g. /path/to/nextcloud/themes

Optional β€” review or leave empty

  • NEXTCLOUD_ADMIN_USER / NEXTCLOUD_ADMIN_PASSWORD β€” if not set, admin account must be created manually on first login
  • NEXTCLOUD_TRUSTED_DOMAINS β€” defaults to localhost, set your host IP or domain to allow external access
  • NEXTCLOUD_THEME_DIR_NAME β€” if not set, no custom theme is mounted
  • ADMINER_DESIGN β€” if not set, defaults to the standard Adminer theme

Step 5 β€” Deploy

Click Deploy the stack.


πŸ—„οΈ Backup

This stack uses Docker volumes for persistent storage.

Volume Type Host path Container path
mariadb_data Docker volume β€” /var/lib/mysql
html Docker volume β€” /var/www/html
apps Bind mount /volume1/docker/nextcloud/custom_apps /var/www/html/custom_apps
config Bind mount /volume1/docker/nextcloud/config /var/www/html/config
data Bind mount /volume1/docker/nextcloud/data /var/www/html/data
theme Bind mount /volume1/docker/nextcloud/themes/<optional_theme_name> /var/www/html/themes/<optional_theme_name>

Warning

This section is currently under review. Backup strategy may change in future updates.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

About

Self-hosted Nextcloud instance using Docker Compose with MariaDB and Adminer, deployed on a Synology NAS.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors