This guide uses Docker Compose to run Nextcloud in containers with a MariaDB database backend.
For Docker installation, see Docker.
Create a docker-compose.yml file with the following content:
version: '3.8'
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=your_root_password
- MYSQL_PASSWORD=your_db_password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud:stable
restart: always
ports:
- 8080:80
volumes:
- nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD=your_db_password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
depends_on:
- db
volumes:
nextcloud:
db:
Security Note: Replace your_root_password and your_db_password with strong, unique passwords before deployment.
docker compose up -d
Wait for the containers to start (approximately 30-60 seconds for first run).
http://YOUR-SERVER:8080 in your browserAfter setup, configure trusted domains to prevent access errors:
# Enter the container
docker compose exec app php occ config:system:set trusted_domains 0 --value=YOUR_SERVER_IP
# Or for domain name
docker compose exec app php occ config:system:set trusted_domains 0 --value=cloud.example.com
For production deployments:
See Configuration and Security for production hardening.
Any questions?
Feel free to contact us. Find all contact information on our contact page.