Nextcloud
Nextcloud is an open-source alternative to Dropbox, Google Drive, and iCloud. You can sync files, manage calendars and contacts, and much more - all on your own server.
Installation
Add the following template to your docker-compose.yml and then run ei23 dc.
Change Passwords!
Change all passwords (password_placeholder, password1_placeholder) before starting!
Network Required
Add the Nextcloud network to the docker-compose.yml.
Template
nextcloud:
image: nextcloud
container_name: nextcloud
ports:
- "8080:80"
volumes:
- ./volumes/nextcloud/html:/var/www/html
restart: unless-stopped
depends_on:
- nextcloud_db
links:
- nextcloud_db
networks:
- default
- nextcloud
environment:
- MYSQL_HOST=nextcloud_db
- MYSQL_PASSWORD=password1_placeholder
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- TRUSTED_PROXIES=172.18.0.0/16
# - OVERWRITEPROTOCOL=https
# - OVERWRITEHOST=example.com
logging:
options:
max-size: "5m"
max-file: "3"
nextcloud_db:
image: yobasystems/alpine-mariadb:10.4.17
container_name: nextcloud_db
volumes:
- ./volumes/nextcloud/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=password_placeholder
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=password1_placeholder
restart: unless-stopped
networks:
- nextcloud
logging:
options:
max-size: "5m"
max-file: "3"
Add Network
Add this network to your docker-compose.yml (e.g., under networks:):
First Start
- After startup, you can access Nextcloud at
http://[IP]:8080 - Create an admin account
- Wait for the installation to complete
Set Up HTTPS (Recommended)
Use Reverse Proxy
For HTTPS, use Traefik or Nginx Proxy Manager.
With Traefik
Uncomment and adjust the labels in the template:
labels:
- traefik.enable=true
- traefik.http.routers.nextcloud.rule=Host(`nextcloud.yourdomain.com`)
- traefik.http.routers.nextcloud.entrypoints=web-secured
- traefik.http.routers.nextcloud.tls=true
- traefik.http.routers.nextcloud.tls.certresolver=letsEncrypt
- traefik.http.middlewares.nextcloud.headers.stsSeconds=15552000
Environment Variables for HTTPS
Clients
Desktop Sync (Windows/macOS/Linux)
- Install the Nextcloud Desktop Client
- Enter the server URL:
http://[IP]:8080orhttps://nextcloud.yourdomain.com - Log in
- Select the folders to sync
Mobile App (Android/iOS)
Apps & Extensions
Nextcloud can be extended through apps:
Recommended Apps
| App | Description |
|---|---|
| Calendar | Calendar with CalDAV sync |
| Contacts | Contacts with CardDAV sync |
| Deck | Project management (Kanban) |
| Notes | Notes |
| Talk | Video calls and chat |
| Files PDF Viewer | PDF preview |
| Preview Generator | Pre-generate thumbnails |
Install Apps
- Click on your profile in the top right
- Go to Apps
- Search for and install the desired app
Sync Calendar & Contacts
Nextcloud offers CalDAV and CardDAV for synchronization:
Android (with DAVx⁵)
- Install DAVx⁵
- Add an account → Login with URL and username
- URL:
http://[IP]:8080/remote.php/dav - Sync calendars and contacts
iOS
- Go to Settings → Calendar → Accounts
- Other Account → CalDAV Account
- Server:
[IP]:8080 - Enter your credentials
Backup & Restore
Backup
# Backup data
cd ~/ei23-docker/
docker compose exec -u www-data nextcloud php occ maintenance:mode --on
sudo tar -czf nextcloud_backup.tar.gz volumes/nextcloud/
docker compose exec -u www-data nextcloud php occ maintenance:mode --off
Restore
# Restore data
docker compose stop nextcloud
sudo rm -rf volumes/nextcloud/
sudo tar -xzf nextcloud_backup.tar.gz
docker compose start nextcloud
OCC Command Line
Nextcloud has a useful CLI tool:
# General
docker compose exec -u www-data nextcloud php occ [command]
# Example: Upgrade after update
docker compose exec -u www-data nextcloud php occ upgrade
# Example: Scan files
docker compose exec -u www-data nextcloud php occ files:scan --all
# Example: Maintenance mode
docker compose exec -u www-data nextcloud php occ maintenance:mode --on/off
Performance Tips
Enable Caching
Add to config.php (under volumes/nextcloud/html/config/):
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'redis',
'port' => 6379,
],
Preview Generator
For faster thumbnails:
Notes
- Data is stored in
./volumes/nextcloud/ - The MariaDB database runs as a separate container
- Regular database backups are essential!
- Nextcloud can consume a lot of RAM - at least 2GB recommended