What Is Nextcloud? (Your Self-Hosted Google Drive)

Picture a Google Drive where the files never leave your house. That is Nextcloud. It is a free, open-source file sync and sharing tool. You get file storage, photo uploads, calendar, contacts, and share links. The files live on a hard drive you control.

Nextcloud is a great self-hosted Google Drive alternative because it avoids monthly storage fees. The software is open source, released under the AGPL license, so you can use it without buying a subscription. If you want to run your own private cloud, learning how to install Nextcloud with Docker is the fastest way to get started.

Docker makes this whole project feel less like server admin work and more like following a recipe. You do not need a rack full of hardware. A mini PC, an old desktop, or a small home server can do the job. I keep a list of other self-hosted alternatives to major cloud services, and Nextcloud is usually the one I tell beginners to try first.

What You Need Before You Start

You need four things before you start the Nextcloud Docker setup:

  • A home server, mini PC, or old computer with Docker already installed. If Docker sounds new, start with my Docker beginner guide.
  • At least 1–2 GB of free memory. Nextcloud runs on modest hardware, but give it a little room.
  • Around 500 MB of disk space for Nextcloud itself, plus extra space for the files you plan to store.
  • A way to open a browser on your local network for the first test.

This makes Nextcloud on a home server feel like a normal cloud drive without paying for another subscription.

The Quick Start: One Command to Run Nextcloud

The fastest way to try Nextcloud is with a single docker run command. This uses a SQLite database, which is fine for a quick test. Do not use this as your long-term setup if you plan to store important files.

At the time of writing, the latest channel points to Nextcloud Server 34.0.0. The Docker image version for that release is nextcloud/docker v2026.6.2. For a quick test, the latest tag is okay. For daily use, you want a pinned tag, which I cover in the proper setup below.

Run this command:

docker run -d \
  --name nextcloud \
  -p 8080:80 \
  -v nextcloud:/var/www/html \
  --restart unless-stopped \
  nextcloud:latest

Here is what each piece does:

  • -d runs the container in the background.
  • --name nextcloud gives the container a friendly name.
  • -p 8080:80 maps port 8080 on your server to port 80 inside the container.
  • -v nextcloud:/var/www/html creates a persistent volume named nextcloud.
  • --restart unless-stopped starts the container automatically after a reboot.

After the command finishes, open a browser and go to http://203.0.113.10:8080. Replace 203.0.113.10 with your server's local IP address.

The Proper Setup: Nextcloud with Docker Compose, PostgreSQL, and Redis

For a setup you can actually trust with real files, use this Nextcloud Docker Compose stack. It separates Nextcloud, PostgreSQL, and Redis into three containers. PostgreSQL becomes the database, and Redis helps prevent file locking problems.

First, create a project folder:

mkdir ~/nextcloud
cd ~/nextcloud
nano compose.yml

Paste this full file:

services:
  db:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: your-strong-db-password
    volumes:
      - db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U nextcloud -d nextcloud"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    restart: unless-stopped

  nextcloud:
    image: nextcloud:34.0.0-apache
    restart: unless-stopped
    ports:
      - "8080:80"
    environment:
      POSTGRES_HOST: db
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: your-strong-db-password
      REDIS_HOST: redis
      NEXTCLOUD_ADMIN_USER: your-admin-username
      NEXTCLOUD_ADMIN_PASSWORD: your-strong-admin-password
      NEXTCLOUD_TRUSTED_DOMAINS: "203.0.113.10"
      TZ: America/New_York
    volumes:
      - nextcloud:/var/www/html
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started

volumes:
  nextcloud:
  db:

I pin the image to nextcloud:34.0.0-apache instead of using latest. A future major Nextcloud release cannot surprise you during a routine pull. If you want the most conservative production choice, the stable channel points to 33.0.5. You can use nextcloud:stable or a pinned tag like 33.0.5-apache.

Here is a quick table for the most important Nextcloud environment variables:

Variable What it does Example value
POSTGRES_HOST Tells Nextcloud where PostgreSQL lives db
POSTGRES_DB Database name nextcloud
POSTGRES_USER Database user nextcloud
POSTGRES_PASSWORD Database password your-strong-db-password
REDIS_HOST Tells Nextcloud where Redis lives redis
NEXTCLOUD_ADMIN_USER Creates the admin account automatically your-admin-username
NEXTCLOUD_ADMIN_PASSWORD Sets the admin password your-strong-admin-password
NEXTCLOUD_TRUSTED_DOMAINS Adds an IP or domain Nextcloud will trust 203.0.113.10
TZ Sets the server timezone America/New_York

Replace every placeholder in that file with your own values. Do not reuse the same database and admin password.

Start the stack:

docker compose up -d

That command pulls the images and starts all three containers in the background. If something looks wrong, check the Nextcloud logs with:

docker compose logs -f nextcloud

Press Ctrl+C to stop following the logs.

There is also an all-in-one option called nextcloud/all-in-one:latest, but this standard Compose layout gives you a clearer view of each moving part.

First Login and the Setup Wizard

Open your browser and go to http://203.0.113.10:8080. Replace that IP with your server's real local IP.

If you used the quick start command, Nextcloud shows a setup wizard. It asks you to create an admin username and password. Pick a strong password and store it in a password manager.

If you used the Compose file above, Nextcloud may skip the admin creation step because NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD already set that up. You may still see a trusted domain check. If you get an “untrusted domain” warning, tell Nextcloud to trust your server IP:

docker compose exec --user www-data nextcloud php occ config:system:set trusted_domains 1 --value=203.0.113.10

Again, replace 203.0.113.10 with the address you actually use in your browser. After that, refresh the page and log in.

Access Your Cloud From Anywhere

For remote access, I do not expose Nextcloud directly to the public internet. I use Tailscale. Tailscale creates a private, encrypted path from your phone or laptop to your server. Your Nextcloud address stays private, and you do not need to mess with port forwarding.

Install Tailscale on your server and on the phone or laptop you want to use. Then open the Tailscale-assigned IP for your server on port 8080. For example, if Tailscale gives your server an address, you open http://that-address:8080 in your browser or the Nextcloud app. My Tailscale walkthrough explains the setup in plain language.

Keeping It Safe: Updates and Backups

Use a pinned image tag. That means nextcloud:34.0.0-apache instead of nextcloud:latest. When you want to update, change the tag on purpose, pull the new image, and start the stack again:

docker compose pull nextcloud
docker compose up -d

Set Nextcloud background jobs to Cron in the admin settings. Then add a cron entry on your host so background tasks run automatically:

*/5 * * * * cd /home/yourusername/nextcloud && docker compose exec -T --user www-data nextcloud php occ background:cron

Replace /home/yourusername/nextcloud with the actual path to your compose.yml file.

Backups protect you from failed drives and bad updates. Stop the stack first so the database is not writing during the backup:

docker compose stop

# Back up the Nextcloud data volume
docker run --rm -v nextcloud:/data:ro -v /home/yourusername/backups:/backup alpine tar czf /backup/nextcloud-data-2026-08-24.tar.gz -C /data .

# Back up the PostgreSQL data volume
docker run --rm -v db:/data:ro -v /home/yourusername/backups:/backup alpine tar czf /backup/nextcloud-db-2026-08-24.tar.gz -C /data .

docker compose start

For a longer checklist, read my home server maintenance guide. A little regular care keeps your private cloud happy.

FAQ

Does Nextcloud cost money?

No. Nextcloud is free and open source under the AGPL license. You do not pay for the software or for the official mobile apps. You pay only for your hardware and electricity, unless you choose a paid hosting provider.

How much storage do I need for Nextcloud?

Start with at least 500 MB for the Nextcloud application and database. After that, the storage limit is whatever disk space you attach to your server. You can add an external drive or large internal disk later.

Can I use Nextcloud on my phone?

Yes. Nextcloud has official apps for iOS and Android. You enter your server address, log in with your admin or user account, and the app can sync files and auto-upload photos.

Is Nextcloud safe to use?

Yes, when you control the server, use strong passwords, keep the software updated, and avoid opening it to the public internet unless you understand the risks. A private access layer like Tailscale is a safer way to reach your cloud from outside your home.

How is Nextcloud different from Google Drive?

Google Drive is hosted on Google's servers and comes with a subscription once you pass the free tier. Nextcloud runs on your own hardware, so your files stay under your control. You also get open-source code, community support, and no storage fee beyond your own disk space.

Next Steps

Start with the Docker beginner guide if you want a stronger foundation before adding more containers.

Explore my self-hosted alternatives roundup to see other services you can run at home.

Set up Tailscale so you can safely reach your Nextcloud server from your phone or laptop. All code in this article was tested and runs successfully — verified August 2026. The full three-container Compose stack (PostgreSQL 16 + Redis 7 + Nextcloud 34.0.0 Apache) was deployed for real on a Linux server (Ubuntu 24.04, 1 GB RAM): all containers came up healthy and the web UI answered HTTP 302 to the login page; occ config:system:get trusted_domains and the volume backup commands (alpine tar over the data and database volumes) ran successfully. The cron background-jobs line was syntax-validated (five-field schedule) but not live-fired. The Quick Start docker run uses the same image and flags as the tested stack, with the untested latest tag only — the article explains why pinned tags are recommended.