A Docker solution for self-hosting Nextcloud.
2.9K
A Docker solution for self-hosting Nextcloudā ā a private cloud platform for file storage, sharing, and collaboration. Built on Alpine Linux with PHP and FreeUnit, configured entirely through environment variables.
*_PASSWORD, *_SECRET) accept a _FILE suffix to load values from mounted secret files (Docker Swarm compatible).docker compose pluginDownload the docker-compose.ymlā file and place it in a convenient location on your disk.
Edit the file to set the required environment variables:
NEXTCLOUD_DOMAINS ā Comma-separated list of trusted domains (e.g. localhost,cloud.example.com).NEXTCLOUD_MAIN_DOMAIN ā Primary domain used for URL generation (e.g. cloud.example.com).MARIADB_PASSWORD / MARIADB_ROOT_PASSWORD ā MariaDB passwords.For a full list of available variables see Configuration Referenceā .
docker compose up -d
On first start the container will download the latest Nextcloud release and configure itself automatically.
Navigate to https://cloud.example.com (or the domain you configured) and complete the web installer.
docker compose down
docker compose down -v
This deletes all Docker volumes (files, database, caches) ā use with caution.
| Variable | Description |
|---|---|
NEXTCLOUD_DOMAINS | Comma-separated list of trusted domains (e.g. localhost,cloud.example.com). |
NEXTCLOUD_MAIN_DOMAIN | Primary domain used for URL generation. |
NEXTCLOUD_DB_TYPE | Database type: mysql, pgsql, or sqlite3. |
| Variable | Default | Description |
|---|---|---|
NEXTCLOUD_SCHEME | http | Protocol used for URL generation (http or https). |
NEXTCLOUD_PHONE_REGION | ā | Default phone region code (e.g. US, RU). |
NEXTCLOUD_TRUSTED_PROXIES | 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 | Comma-separated list of trusted reverse proxy IPs or CIDR ranges. |
NEXTCLOUD_RELEASE_URL | Latest release | Custom Nextcloud ZIP download URL (useful for pinning a version). |
mysql / pgsql)| Variable | Description |
|---|---|
NEXTCLOUD_DB_HOST | Database host. |
NEXTCLOUD_DB_NAME | Database name. |
NEXTCLOUD_DB_USER | Database user. |
NEXTCLOUD_DB_PASSWORD | Database password. Supports NEXTCLOUD_DB_PASSWORD_FILE. |
| Variable | Default | Description |
|---|---|---|
NEXTCLOUD_CACHE_MODE | apcu | Cache backend: apcu, redis, or memcached. |
NEXTCLOUD_CACHE_REDIS_HOST | ā | Redis / Valkey host (required for redis mode). |
NEXTCLOUD_CACHE_REDIS_PORT | ā | Redis / Valkey port (required for redis mode). |
NEXTCLOUD_CACHE_REDIS_USER | ā | Redis user. Supports _FILE. |
NEXTCLOUD_CACHE_REDIS_PASSWORD | ā | Redis password. Supports _FILE. |
NEXTCLOUD_CACHE_MEMCACHED_HOST | ā | Memcached host (required for memcached mode). |
NEXTCLOUD_CACHE_MEMCACHED_PORT | ā | Memcached port (required for memcached mode). |
| Variable | Description |
|---|---|
NEXTCLOUD_SMTP_MODE | Mail mode: smtp or sendmail. Leave unset to disable. |
NEXTCLOUD_SMTP_HOST | SMTP server hostname. |
NEXTCLOUD_SMTP_PORT | SMTP server port. |
NEXTCLOUD_SMTP_SECURE | Encryption: SSL, TLS, or empty. |
NEXTCLOUD_SMTP_AUTH | Enable SMTP authentication: true or false. |
NEXTCLOUD_SMTP_AUTH_TYPE | Auth type (e.g. LOGIN). |
NEXTCLOUD_SMTP_USER | SMTP username. |
NEXTCLOUD_SMTP_PASSWORD | SMTP password. Supports NEXTCLOUD_SMTP_PASSWORD_FILE. |
NEXTCLOUD_SMTP_FROM | From address user part (e.g. cloud). |
NEXTCLOUD_SMTP_DOMAIN | From address domain. |
Set NEXTCLOUD_RELEASE_URL to a specific release ZIP:
NEXTCLOUD_RELEASE_URL=https://download.nextcloud.com/server/releases/nextcloud-30.0.0.zip
Run the container in foreground mode to see live logs:
docker compose up
Or check logs of a running service:
docker compose logs -f app
A Makefile is included for developers. It simplifies building and managing the container.
make init ā Copy .env.dist to .env.make clean ā Remove unused Docker resources.make pull ā Pull base images.make build ā Build the Nextcloud Docker image.make push ā Push the built image to a registry.make up ā Start the service.make down ā Stop the service.make down-with-volumes ā Stop the service and delete volumes.make restart ā Restart the service.This project is licensed under MIT licenseā .
Maintainer: Eugene Frostā Repository: GitHubā Registry: Docker HUBā
ā„ļø Issues and pull requests are welcome!
Content type
Image
Digest
sha256:4589c5564ā¦
Size
87.8 MB
Last updated
about 2 months ago
docker pull tuzelko/nextcloud