$selfhostrecipes.com
·10 min read

Nextcloud All-in-One with Docker Compose: How the Mastercontainer Actually Works

A practical walkthrough of Nextcloud AIO: what the mastercontainer does, a Compose file to run it, first-login gotchas, reverse proxy notes and how its built-in BorgBackup fits in.

nextclouddocker-composebackupself-hostingstorage

01What Nextcloud AIO Is (and Isn't)

Nextcloud All-in-One, usually shortened to AIO, is described by its maintainers as the official Nextcloud installation method. Instead of writing a Compose file with Nextcloud, a database, a cache, a web server and a bunch of optional services, you start one container, the mastercontainer, and it starts and manages the rest for you through a web interface. The core stack it brings up includes Nextcloud itself, PostgreSQL, Redis, an Apache container for the proxy and HTTPS layer, and a push service for real-time sync. On top of that you can switch on optional containers from the interface: Nextcloud Office, Talk (with a TURN server), Talk Recording, ClamAV antivirus, Imaginary for image previews, full-text search and Whiteboard. There is also a set of community containers if you want extras. The mental model matters here. AIO is not a normal multi-service Compose project. Your Compose file only describes the mastercontainer. The mastercontainer then uses the Docker socket to manage the other containers itself. If you are used to editing a Compose file to change every service, you will need to adjust: most changes happen in the AIO interface. This post is a walkthrough based on the upstream README and release notes. For a hands-on recipe version, see the [Nextcloud AIO recipe](https://selfhostrecipes.com/storage/nextcloud-aio), and for the authoritative reference use the [upstream repository](https://github.com/nextcloud/all-in-one).

If you would rather assemble each Nextcloud component yourself and control every service in Compose, AIO is probably the wrong tool. It trades fine-grained control for a managed, opinionated stack.

02Prerequisites Before You Start

The recipe lists Docker Engine 20.10 or newer, with access to the Docker socket, since the mastercontainer needs it to orchestrate everything. It also suggests at least 4 GB of RAM if you plan to run the full stack with Office and Talk enabled, and 50 GB or more of free disk for data and backups. Treat those as starting points for sizing, not hard limits. For a production setup you will want a domain name you control that points at the server. AIO obtains certificates through Let's Encrypt, which is why ports 80 and 8443 matter during setup, and why 443 (TCP and UDP, for HTTP/3) is used later once Nextcloud is being served. If you enable Talk, upstream also says to open port 3478 for both TCP and UDP for the TURN container. One more thing to check on Ubuntu hosts: snap-based Docker installations are not supported by AIO. The README gives a quick way to see whether you are running one. If the command below prints a path under /var/snap/docker/, migrate to a regular Docker install first, and only remove the snap once you are sure nothing important is running in it.
[check-snap-docker.sh]
1# Prints /var/snap/docker/ if you are on a snap-based Docker install (not supported by AIO)
2sudo docker info | grep "Docker Root Dir" | grep "/var/snap/docker/"

03The Compose File

Upstream suggests using a Compose file rather than a long `docker run` command for anything beyond a quick test, since it makes upgrades and changes easier. The file below follows the recipe: one service, the mastercontainer, with a named volume and the Docker socket mounted read-only. A few details are not negotiable. The container name must stay `nextcloud-aio-mastercontainer`, because mastercontainer updates rely on it. The volume name must stay `nextcloud_aio_mastercontainer`, because the built-in backup depends on it. That is why the volume has an explicit `name:` key, so Compose does not prefix it with the project name. The image is published as `ghcr.io/nextcloud-releases/all-in-one:latest`; AIO updates itself and the containers it starts from its own interface, so `latest` is what upstream ships here. If you want Nextcloud's data directory somewhere other than the default Docker volume, upstream mentions setting the `NEXTCLOUD_DATADIR` environment variable on first startup, for example to a path like /mnt/ncdata. Decide this before you run the first install, not after.
[compose.yaml]
1name: nextcloud-aio
2services:
3 nextcloud-aio-mastercontainer:
4 # AIO updates itself and the containers it starts from the AIO interface
5 image: ghcr.io/nextcloud-releases/all-in-one:latest
6 init: true
7 restart: always
8 # AIO requires this exact container name
9 container_name: nextcloud-aio-mastercontainer
10 volumes:
11 # Keep this volume name or the built-in backup will not work
12 - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
13 - /var/run/docker.sock:/var/run/docker.sock:ro
14 network_mode: bridge
15 ports:
16 - "80:80"
17 - "8080:8080"
18 - "8443:8443"
19
20volumes:
21 nextcloud_aio_mastercontainer:
22 name: nextcloud_aio_mastercontainer

The mastercontainer needs the Docker socket to do its job, which is a powerful permission. If you are uncomfortable with that, upstream documents a manual install that works without a container having socket access.

04First Start and the AIO Interface

Bring it up with `docker compose up -d`, then open the AIO interface on port 8080 of your server. This is where people trip up: use the server's IP address, not a domain name. Port 8080 serves a self-signed certificate that you have to accept in the browser, and upstream warns that accessing it through a domain may work for a while but is likely to break later because of HSTS. If your router forwards ports 80 and 8443 and a domain already points at the server, you can instead use that domain on port 8443 and get a valid certificate for the interface itself. The interface generates a passphrase the first time. Save it somewhere safe in your password manager, because you need it to log in later. Upstream release notes also mention that since AIO 14.3.0 a password is always required for logging in, so there is no way around that step. After that, the flow is straightforward: enter your domain, let AIO check it, pick the optional containers you want, and start the stack. If you do not have a domain yet, the README describes a built-in option to register a free dynamic-DNS subdomain through deSEC, which is handy for trying things out.
[start-aio.sh]
1docker compose up -d
2# Then browse to https://<server-ip>:8080 and accept the self-signed certificate

05Running Behind a Reverse Proxy

The default setup assumes AIO talks directly to the internet and handles its own certificates. That is fine on a dedicated box, but many of us already run Traefik, Caddy, nginx or a tunnel on the same host. In that case the README is clear: do not follow the default instructions, follow the dedicated reverse proxy document instead. According to the recipe's usage notes, the main changes are setting `APACHE_PORT` on the mastercontainer and removing the port 80 and 8443 mappings, since your proxy owns those. The exact values and proxy snippets for different servers live in the upstream [reverse proxy documentation](https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md), and I would copy from there rather than from memory. Domain validation is another thing to know about. AIO checks that your domain points at the server and is reachable. If you have everything configured correctly and validation still fails, there is a `SKIP_DOMAIN_VALIDATION=true` option for the mastercontainer. Use it only after double-checking DNS and your proxy, because it hides a real misconfiguration just as easily as a false alarm. The README also says AIO can be used behind a Cloudflare Tunnel or via Tailscale, with notes for each in the upstream FAQ.

Make your proxy changes in a test deployment first. Upstream itself points out that test deployments of AIO are cheap and disposable.

06Backups: Built In, but Off by Default

The feature that convinced me to take AIO seriously is the integrated backup. It is based on BorgBackup and managed from the AIO interface, covering backup creation, restore, integrity checks and integrity repair. Importantly, it is optional and off until you choose a backup location, which can be a local path or a remote Borg repository. Once you have taken a first backup, you can enable daily backups, and a recent release added the choice of daily or weekly. The interface can also update all containers, Nextcloud and its apps after the backup finishes, so updates are tied to having a fresh restore point. You can also include extra Docker volumes or host paths in the backup if you want to cover more than Nextcloud's own data. Restoring is where the design pays off: according to the README, you only need the backup archive and its password to restore the whole instance onto a new AIO instance. That makes moving to new hardware relatively painless, as long as you keep that password somewhere other than the server itself. Two practical points. If you use a local backup path, put it on a different drive from your Nextcloud data, since a backup on the same disk protects you from far fewer failures. And actually test a restore on a spare machine before you rely on it. A backup you have never restored is a hope, not a plan.

07Updates, Release Notes and Final Thoughts

Updates are handled from the AIO interface, which shows notifications when new container versions are available. As I write this, the latest release in the notes I read is v15.2.0, and it bundles Nextcloud 35.0.3. Recent release notes show the project is actively tightening things up: options to run the containers with no-new-privileges, an append-only flag for Borg repositories, and a number of security-related fixes to individual containers. It is worth skimming the release notes before a big update, particularly if you use community containers. My summary: AIO is a good fit if you want a complete Nextcloud with caching, database, optional office suite, Talk and backups, without hand-assembling and maintaining each piece. It is a weaker fit if you need to customize each service in Compose or you cannot give a container access to the Docker socket. A short checklist to finish: confirm your Docker install is not snap-based, keep the container and volume names untouched, access the interface by IP on port 8080, store the passphrase, set up a backup location on separate storage, and test a restore. If you want a condensed version of the same setup, the [Nextcloud AIO recipe](https://selfhostrecipes.com/storage/nextcloud-aio) is a good companion to this post.

About the Author

Frank Pegasus

Pen name of the Selfhost Recipes editors. Guides are written for people running their own services with Docker Compose and are checked against the official documentation of the tools they cover.