• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Solutions Docker

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

neo by neo
June 10, 2025
in Docker
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
87
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

Introduction

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).

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

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
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.

About The Author

neo

See author's posts

Tags: nextcloud
ADVERTISEMENT
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

neo

Related Posts

My Ultimate Docker Command Cheat Sheet (2025 Edition)
Docker

My Ultimate Docker Commands Cheat Sheet (2025 Edition)

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script
Docker

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

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

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

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

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

Install Docker on Raspberry Pi 4 with Ubuntu 22.04
Docker

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *


Recommended

WordPress: Installation on Ubuntu 22.04

WordPress: Installation on Ubuntu 22.04

Fortinet FortiGate: Reverse Path Forwarding (RPF)

Fortinet FortiGate: Reverse Path Forwarding (RPF)

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)

My Ultimate Docker Command Cheat Sheet (2025 Edition)

My Ultimate Docker Commands Cheat Sheet (2025 Edition)

My Ultimate FortiGate Command Cheat Sheet

My Ultimate FortiGate Command Cheat Sheet

Categories

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos
ADVERTISEMENT

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

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)

My Ultimate Docker Command Cheat Sheet (2025 Edition)

My Ultimate Docker Commands Cheat Sheet (2025 Edition)

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

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.