Deploy Your Own Nextcloud Private Cloud with Docker in Minutes
This step‑by‑step guide shows how to install Docker CE on CentOS, pull the Nextcloud image, run the container with proper volume and port mappings, configure firewall and security groups, and finally access the web interface to set up a fully functional private cloud storage solution.
Introduction
Nextcloud is an open‑source private‑cloud storage project that provides cross‑platform file sync, sharing, version control, and collaboration. Deploying it with Docker ensures a consistent, portable environment.
Step 1 – Install and start Docker CE
cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
# Install dependencies
yum install -y yum-utils device-mapper-persistent-data lvm2
# Add Docker repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# Install Docker CE
yum -y install docker-ce
# Start and enable Docker service
systemctl start docker && systemctl enable dockerStep 2 – Pull the Nextcloud image
docker pull nextcloudStep 3 – Run the Nextcloud container
mkdir /nextcloud
docker run -d --name nextcloud -p 2020:80 -v /nextcloud:/var/www/html nextcloudExplanation of the command: docker run: start a container -d: run in background --name nextcloud: name the container -p 2020:80: map host port 2020 to container port 80 -v /nextcloud:/var/www/html: mount host directory to container data directory nextcloud: image name
Step 4 – Enable container auto‑restart
docker update --restart=always nextcloudStep 5 – Open firewall or allow port 2020
# Stop firewalld
systemctl stop firewalld
# Or open port 2020 permanently
firewall-cmd --permanent --zone=public --add-port=2020/tcp
firewall-cmd --reloadStep 6 – Enable IPv4 forwarding (if needed)
# Enable IPv4 forwarding
vim /etc/sysctl.conf
net.ipv4.ip_forward=1
systemctl restart network
# Verify
sysctl net.ipv4.ip_forwardStep 7 – Configure cloud‑host security group
In the cloud provider console, add a rule to allow inbound traffic on port 2020 for all IPs.
Access the web interface
Open http://{your_server_ip}:2020 in a browser, set the admin username and password, and choose SQLite for a single‑user setup or another database for multi‑user scenarios.
Client experience
After deployment, you can access Nextcloud from Windows, macOS, Android, iOS, or any WebDAV‑compatible client.
Notes
The demo uses a 1 M bandwidth cloud host; performance may degrade with many users. This guide is intended for learning and testing purposes only.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
