• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Linux
    • Bash Scripting
      • Bash Scripting Lessons
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Tools
No Result
View All Result
  • Home
  • Linux
    • Bash Scripting
      • Bash Scripting Lessons
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Tools
No Result
View All Result
DefenceDev
No Result
View All Result
Home Linux

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

by neo
September 3, 2026
in Linux
0
Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

0
SHARES
172
VIEWS
Share on FacebookShare on LinkedIn
Table of Contents
  • Nextcloud on Raspberry Pi 4
  • Prerequisites
  • Steps to Install Nextcloud on Raspberry Pi 4
    • 1. Create Directories for Nextcloud
    • 2. Create the docker-compose.yaml File
    • 3. Start the Nextcloud Container
    • 4. Complete the Setup via Web Interface
  • Troubleshooting Commands
    • docker network ls
    • docker network create nginx_network
    • sudo lsof -i :8080
    • Add Trust Domains in Your NextCloud Docker Configuration
    • Configuration in Nginx Proxy Manager
  • Conclusion

Nextcloud on Raspberry Pi 4

Looking for a secure and private cloud storage solution you can host at home? In this guide, you’ll learn how to Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04) — a powerful combination that gives you full control over your data.

By using Docker on Ubuntu 22.04, we simplify the deployment process and make it easy to manage updates and configurations. Whether you’re a beginner or an experienced developer, this step-by-step tutorial will help you Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04) quickly and efficiently.

Prerequisites

Before you begin, make sure you have the following:

  • Raspberry Pi 4 (4GB RAM or more recommended)
  • Ubuntu 22.04 (or a similar Linux distribution) installed
  • Docker and Docker Compose installed
  • Nginx Proxy Manager already set up (if you’re using a reverse proxy)
  • Stable internet connection
  • Basic command-line knowledge

Steps to Install Nextcloud on Raspberry Pi 4

1. Create Directories for Nextcloud

Run the following commands to create directories for application files and user data:

sudo mkdir -p /opt/nextcloud/app
sudo mkdir -p /opt/nextcloud/data

chown -R www-data:www-data /opt/nextcloud
chmod -R 750 /opt/nextcloud

These directories will be mounted into the container to ensure data persistence.

2. Create the docker-compose.yaml File

mkdir ~/nextcloud && cd ~/nextcloud
nano docker-compose.yaml
services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    restart: always
    ports:
      - 8080:80
    volumes:
      - /opt/nextcloud/app:/var/www/html
      - /opt/nextcloud/data:/var/www/html/data
    networks:
      - nginx-proxy-manager_npm_network
    environment:
      - PHP_UPLOAD_LIMIT=10G


networks:
  nginx-proxy-manager_npm_network:
    external: true

This configuration uses an external Docker network shared with Nginx Proxy Manager and allows file uploads up to 10GB.

3. Start the Nextcloud Container

Run the following command to start the container:

docker compose up -d

Docker will pull the necessary image and start the Nextcloud container. The app will be accessible at http://<your-RPi-IP>:8080.

With this command you can check if the NextCloud is Running:

docker ps

4. Complete the Setup via Web Interface

Open your browser and go to http://<your-RPi-IP>:8080. Follow the on-screen instructions to create an admin account and configure the database (you can use SQLite for testing or connect to an external MariaDB instance).

In my case, I chose SQLite (which is not recommended for large environments) and simply entered a username and password for the Nextcloud application.

Troubleshooting Commands

docker network ls


Lists all Docker networks currently available on your system.
Useful for checking existing networks before creating a new one or troubleshooting connectivity between containers.

docker network create nginx_network


Creates a new user-defined Docker bridge network named nginx_network.
This is often used to allow multiple containers (e.g., Nginx, Nextcloud, database) to communicate with each other securely and efficiently.

sudo lsof -i :8080


Lists all processes currently using port 8080.
This is helpful to check if the port you plan to use (e.g., for Nginx or Nextcloud) is already occupied by another service.

Add Trust Domains in Your NextCloud Docker Configuration

nano /opt/nextcloud/app/config/config.php
'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.x.x',
    2 => 'data.defencedev.com',
  ),

Configuration in Nginx Proxy Manager

Under Host you can configure the following:

Nginx Proxy Manager Host Configuration
Nginx Proxy Manager Host Configuration

If you have issues with Sessions when visiting your NextCloud you can disable “Block Common Exploits”.

SSL Configuration with Nginx Proxy Manager
SSL Configuration with Nginx Proxy Manager
Advanced Configuration with Nginx Proxy Manager
Advanced Configuration with Nginx Proxy Manager
client_max_body_size 10G;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

Conclusion

Installing Nextcloud on a Raspberry Pi 4 using Docker is a great way to set up your own private cloud. With Docker Compose, the setup is easy to manage and scale. The next step could be integrating and enabling HTTPS via Nginx Proxy Manager.

Tags: dockernextcloudraspberry-pi
Previous Post

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Next Post

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

neo

Related Posts

Get Instant SSH Login Alerts on Ubuntu with Bash and Telegram
Monitoring

Get Instant SSH Login Alerts on Ubuntu with Bash and Telegram

Terminal Colors in Bash: How and When to Use Them
Bash Scripting

Terminal Colors in Bash: How and When to Use Them

Solution: Ubuntu Internet Connection Monitoring Script (Create a Log File, Possible to Send per Email)
Monitoring

Ubuntu Internet Connection Monitoring Script: Log Creation and Email Alerts

Free Online Image Tools– Fast, Private, and 100% Browser‑Based
Linux

Free Online Image Tools– Fast, Private, and 100% Browser‑Based

10+ Useful Linux find Command Examples You Should Know
Commands&Tips

10+ Useful Linux find Command Examples You Should Know

Server Reboot with Ansible
Linux

Automating Linux Server Reboot with Ansible

Next Post
Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Recommended

YouTube Channel about Linux Topics

YouTube Channel about Linux Topics

Solutions: Add New Hard Drive (HDD or SSD) to Ubuntu

Add and Mount New HDD or SSD on Ubuntu – Easy Tutorial

Briefly unavailable for scheduled maintenance. Check back in a minute.

WordPress Stuck in Maintenance Mode After Plugin Update

Promox Telegram Alert Example

Configure Telegram Notifications in Proxmox VE Using Webhooks

Fix Proxmox VM Snapshot “Out of Space” Errors

Fix Proxmox VM Snapshot “Out of Space” Errors

Categories

  • Linux
    • Bash Scripting
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Web Tools

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

Briefly unavailable for scheduled maintenance. Check back in a minute.

WordPress Stuck in Maintenance Mode After Plugin Update

Promox Telegram Alert Example

Configure Telegram Notifications in Proxmox VE Using Webhooks

  • Site Map
  • Privacy Policy
  • Facebook Page
  • GitHub
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Linux
    • Bash Scripting
      • Bash Scripting Lessons
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Tools

© 2025 defencedev.com - All rights reserved.