1. Introduction
- Why build your own?
- Storing large amounts of data on public cloud services can be expensive.
I wanted to set up my own storage server in a local environment to save costs.
Why Nextcloud + Docker?
Ease of Setup: Get up and running quickly.
Simple Maintenance: Easy to update and manage containers.
2. Environment
- OS: Debian Linux
- Prerequisites: A system where Docker and Docker Compose can be installed.
3. Step-by-Step Guide
- Install Docker
sudo apt install docker.io docker-compose-plugin
- Create a Working Directory
mkdir nextcloud
cd nextcloud
- Create `docker-compose.yml`
nano docker-compose.yml
services:
db:
image: mariadb:10.11
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- nextcloud_db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
app:
image: nextcloud:apache
restart: always
ports:
- 8080:80
depends_on:
- db
volumes:
- nextcloud_data:/var/www/html
environment:
MYSQL_HOST: db
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
nextcloud_db:
nextcloud_data:
-
Create
.envfile
nano .env
MYSQL_ROOT_PASSWORD=change-me
MYSQL_PASSWORD=change-me
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud
- Launch Containers
docker compose up -d
4. Post-Installation & Operation
- Initial Setup via Browser
- Access
http://localhost:8080and create an admin account. Tip: Most DB settings from your
.envfile will be auto-filled. Just double-check them!Useful Commands
Status check, Update, Start/Stop, and Logs.
5. Conclusion & Security
- Personal Reflection: Using Docker makes maintenance incredibly easy.
- Important Security Note: This setup is not encrypted (No SSL). If you plan to access it from the internet, please use a Reverse Proxy or a tool like Tailscale.
Top comments (0)