Nextcloud
Self-hosted file sync and share platform with collaborative office suite, calendar, contacts, and extensive app ecosystem.
Overview
Nextcloud is a self-hosted productivity platform that emerged as a fork of ownCloud in 2016, offering comprehensive file synchronization, sharing, and collaboration capabilities. As a privacy-focused alternative to Google Drive and Microsoft 365, Nextcloud provides file storage, collaborative office suite, calendar, contacts, video calls, and an extensive app ecosystem with over 200 applications. This configuration combines Nextcloud with MariaDB for robust database operations and Redis for high-performance caching and session management. MariaDB serves as the primary database backend, providing enhanced features over standard MySQL including improved performance and clustering capabilities, while Redis acts as an in-memory cache to accelerate file operations, user sessions, and transactional locking. This three-component stack delivers enterprise-grade performance for teams requiring self-hosted collaboration tools with complete data sovereignty. Organizations choosing this setup gain a fully-featured productivity platform that rivals commercial cloud services while maintaining complete control over their data, making it ideal for privacy-conscious businesses, educational institutions, and technical teams who need reliable file sync with collaborative features.
Key Features
- Real-time file synchronization across desktop and mobile clients with conflict resolution
- Collaborative document editing with OnlyOffice or Collabora Online integration
- CalDAV and CardDAV support for calendar and contact synchronization
- Video conferencing and chat through Nextcloud Talk with screen sharing
- MariaDB's Aria storage engine providing crash-safe tables and improved performance
- Redis-powered session management reducing database load and improving response times
- End-to-end encryption for files with client-side key management
- Extensive app marketplace with workflow automation, project management, and security tools
Common Use Cases
- 1Replace Google Workspace or Microsoft 365 for small to medium businesses requiring data privacy
- 2Educational institutions needing FERPA-compliant file sharing and collaboration platform
- 3Remote teams requiring secure file sync with integrated video conferencing capabilities
- 4Healthcare organizations managing patient data with HIPAA compliance requirements
- 5Software development teams sharing code repositories and project documentation
- 6Home lab enthusiasts creating personal cloud storage with family sharing features
- 7Non-profit organizations needing cost-effective collaboration tools with donor data protection
Prerequisites
- Minimum 3GB RAM (2GB for Nextcloud, 512MB for MariaDB, 256MB for Redis)
- At least 20GB available disk space for initial installation and user data
- Port 8080 available on host system for web interface access
- Basic understanding of environment variables and Docker volume management
- SSL certificate and reverse proxy knowledge for production HTTPS deployment
- Familiarity with Nextcloud admin interface for user management and app installation
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 nextcloud: 3 image: nextcloud:apache4 container_name: nextcloud5 restart: unless-stopped6 environment: 7 MYSQL_HOST: mariadb8 MYSQL_DATABASE: ${MYSQL_DATABASE}9 MYSQL_USER: ${MYSQL_USER}10 MYSQL_PASSWORD: ${MYSQL_PASSWORD}11 REDIS_HOST: redis12 volumes: 13 - nextcloud_data:/var/www/html14 ports: 15 - "8080:80"16 depends_on: 17 - mariadb18 - redis19 networks: 20 - nextcloud2122 mariadb: 23 image: mariadb:1124 container_name: nextcloud-mariadb25 environment: 26 MARIADB_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}27 MARIADB_DATABASE: ${MYSQL_DATABASE}28 MARIADB_USER: ${MYSQL_USER}29 MARIADB_PASSWORD: ${MYSQL_PASSWORD}30 volumes: 31 - mariadb_data:/var/lib/mysql32 networks: 33 - nextcloud3435 redis: 36 image: redis:alpine37 container_name: nextcloud-redis38 networks: 39 - nextcloud4041volumes: 42 nextcloud_data: 43 mariadb_data: 4445networks: 46 nextcloud: 47 driver: bridge.env Template
.env
1MYSQL_ROOT_PASSWORD=rootpassword2MYSQL_DATABASE=nextcloud3MYSQL_USER=nextcloud4MYSQL_PASSWORD=changemeUsage Notes
- 1Docs: https://docs.nextcloud.com/server/latest/admin_manual/
- 2Access at http://localhost:8080 - complete setup wizard on first visit
- 3Install apps: Files, Calendar, Contacts, Talk (video calls), Office (Collabora/OnlyOffice)
- 4Enable cron: docker exec -u www-data nextcloud php cron.php (add to host crontab)
- 5Sync clients available for desktop (Win/Mac/Linux) and mobile (iOS/Android)
- 6Background jobs: set to Cron in Admin > Basic settings for better performance
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
nextcloud
nextcloud:
image: nextcloud:apache
container_name: nextcloud
restart: unless-stopped
environment:
MYSQL_HOST: mariadb
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
REDIS_HOST: redis
volumes:
- nextcloud_data:/var/www/html
ports:
- "8080:80"
depends_on:
- mariadb
- redis
networks:
- nextcloud
mariadb
mariadb:
image: mariadb:11
container_name: nextcloud-mariadb
environment:
MARIADB_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MARIADB_DATABASE: ${MYSQL_DATABASE}
MARIADB_USER: ${MYSQL_USER}
MARIADB_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- mariadb_data:/var/lib/mysql
networks:
- nextcloud
redis
redis:
image: redis:alpine
container_name: nextcloud-redis
networks:
- nextcloud
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 nextcloud:5 image: nextcloud:apache6 container_name: nextcloud7 restart: unless-stopped8 environment:9 MYSQL_HOST: mariadb10 MYSQL_DATABASE: ${MYSQL_DATABASE}11 MYSQL_USER: ${MYSQL_USER}12 MYSQL_PASSWORD: ${MYSQL_PASSWORD}13 REDIS_HOST: redis14 volumes:15 - nextcloud_data:/var/www/html16 ports:17 - "8080:80"18 depends_on:19 - mariadb20 - redis21 networks:22 - nextcloud2324 mariadb:25 image: mariadb:1126 container_name: nextcloud-mariadb27 environment:28 MARIADB_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}29 MARIADB_DATABASE: ${MYSQL_DATABASE}30 MARIADB_USER: ${MYSQL_USER}31 MARIADB_PASSWORD: ${MYSQL_PASSWORD}32 volumes:33 - mariadb_data:/var/lib/mysql34 networks:35 - nextcloud3637 redis:38 image: redis:alpine39 container_name: nextcloud-redis40 networks:41 - nextcloud4243volumes:44 nextcloud_data:45 mariadb_data:4647networks:48 nextcloud:49 driver: bridge50EOF5152# 2. Create the .env file53cat > .env << 'EOF'54MYSQL_ROOT_PASSWORD=rootpassword55MYSQL_DATABASE=nextcloud56MYSQL_USER=nextcloud57MYSQL_PASSWORD=changeme58EOF5960# 3. Start the services61docker compose up -d6263# 4. View logs64docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/nextcloud/run | bashTroubleshooting
- Database connection errors during setup: Verify MYSQL_* environment variables match between nextcloud and mariadb services
- Slow file uploads or timeouts: Increase PHP memory limits and execution time in Nextcloud container using custom php.ini
- Redis connection failures: Check that redis container is running and nextcloud can resolve 'redis' hostname on docker network
- Trusted domain warnings: Add your domain/IP to trusted_domains array in Nextcloud config/config.php file
- MariaDB crashes or corruption: Ensure mariadb_data volume has proper permissions and sufficient disk space
- Background job warnings in admin panel: Set up cron job on host to run 'docker exec -u www-data nextcloud php cron.php' every 5 minutes
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
nextcloudmariadbredis
Tags
#nextcloud#files#sync#collaboration#office#privacy
Category
Productivity & CollaborationAd Space
Shortcuts: C CopyF FavoriteD Download