
Install Nextcloud with Docker
This guide shows how to install Nextcloud, the open-source platform for your own cloud with files, calendars and contacts, with MariaDB via Docker Compose on your Linux server. It covers the Compose file, the web setup and HTTPS access via a reverse proxy.
Step 1: Create the Docker Compose File
Log in to your server via SSH, create a directory for Nextcloud, and open the Compose file:
Paste the following content into the file. Replace the password placeholders with your own secure values — more on this in Step 2.
Step 2: Set Your Passwords
Before proceeding, replace both placeholders in the file with your own secure passwords:
| Placeholder | Description |
|---|---|
| YOUR_STRONG_ROOT_PASSWORD | Root password for MariaDB — used internally only |
| YOUR_STRONG_MYSQL_PASSWORD | Password for the Nextcloud database user — must be identical in both db and app |
The MYSQL_PASSWORD must be exactly the same in both the db and app services — otherwise Nextcloud will not be able to connect to the database.
Step 3: Start the Stack
Start the entire Nextcloud stack with a single command. Docker will pull the required images and start all containers in the background.
The -d flag stands for "detached mode" — the containers run in the background without blocking your terminal session.
Step 4: Complete Setup in the Browser
Once the containers are running, Nextcloud is accessible in your browser. Open:
http://YOUR_SERVER_IP:8080
| Field | Value |
|---|---|
| Database user | nextcloud |
| Database password | YOUR_STRONG_MYSQL_PASSWORD |
| Database name | nextcloud |
| Database host | db |
Click Finish setup. After a few moments you will be logged in to your new Nextcloud instance.
Step 5: Set Up a Reverse Proxy for HTTPS (Recommended)
For a production-ready setup, you should not access Nextcloud permanently via IP address and port 8080. A reverse proxy routes traffic from your domain and enables HTTPS encryption — allowing you to reach Nextcloud securely via an address like https://cloud.yourdomain.com.
Common tools for this are Nginx Proxy Manager, Traefik, or Caddy. All three can also run as Docker containers and integrate well with this setup.
Further Documentation
For detailed configuration options and advanced setup scenarios, we recommend the official Nextcloud documentation.