Self-Hosted Cloud Storage: Deploying Nextcloud via Docker
Taking complete ownership of your personal files, photo libraries, contacts, and calendar events is simple with Nextcloud. By deploying Nextcloud inside a Docker Compose environment paired with a MariaDB database and Redis cache, you eliminate monthly cloud subscription fees while maintaining total data privacy. At Android People (androidpeople.in), we share a complete step-by-step deployment guide.
Step 1: Preparing Project Directories
Connect to your Linux server via SSH, create a dedicated directory named nextcloud, and navigate into it:
mkdir -p ~/nextcloud && cd ~/nextcloudStep 2: Writing Docker Compose Configuration File
Create a file named docker-compose.yml and add the following configuration stack:
version: '3.8'
services:
db:
image: mariadb:10.11
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- db_data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=YourSecureRootPassword
- MYSQL_PASSWORD=YourDatabasePassword
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
redis:
image: redis:alpine
restart: always
app:
image: nextcloud:latest
restart: always
ports:
- 8080:80
volumes:
- nextcloud_data:/var/www/html
environment:
- MYSQL_PASSWORD=YourDatabasePassword
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- REDIS_HOST=redis
depends_on:
- db
- redis
volumes:
db_data:
nextcloud_data:Step 3: Launching Containers and Initial Web Setup
Launch the container stack in detached mode by running:
docker compose up -dOnce the containers are running, open a web browser and navigate to http://<YOUR_SERVER_IP>:8080. Create your administrator account and follow the wizard to complete initial setup.
Frequently Asked Questions
Should I use Nextcloud All-in-One (AIO) or custom Docker Compose?
Nextcloud AIO is recommended for users wanting automated backups and built-in SSL, while custom Docker Compose offers full flexibility for existing reverse proxy environments.
For more home server tutorials and self-hosting guides, keep visiting Android People.