Nextcloud: Docker or dedicated server


I am currently using Nextcloud in Docker, with 3 containers, one for Nextcloud itself, one for MariaDB and one for Redis. I have no idea any more why Redis, but configured it according to some tutorials, and it was recommended. MariaDB also simply because it was recommended.
I don’t completely dislike the concept, but I do question if I should proceed with this or I should reinstall Nextcloud on a solo-server (ironically, I used to have a single server, and moved to docker).

Why? I have a feeling that installing of additional features might be simpler. Am I mistaken, and should manage docker better, meaning make any adjustments in the docker deployment and be done with it? What is actually a preferred way?

What I am doing or planning on doing with Nextcloud:
Currently simply using it between my iPhone, iPad and PC to sync my Password-Database and for some simple sharing folders.
What I intend to do is a connection to my TrueNAS, which will host my Photos, which Nextcloud should mount (not host), meaning I want a link to the folder where photos are. I would like to remain on a folder structure I always had, I am going to buy a Mac, and still would like to keep it that way, however I would also like to have the photos visible in the Nextcloud App on my phone, which are basically in the archive.

I still didn’t really decide or test how the photo system of Nextcloud works, so can’t say much about that.

Anyway, my first decision is whether I continue with Docker or change back to single server.

Can you comment?


When you asks docker, Why docker?
then you get this answer:

Developing apps today requires so much more than writing code. Multiple languages, frameworks, architectures, and discontinuous interfaces between tools for each lifecycle stage creates enormous complexity. Docker simplifies and accelerates your workflow, while giving developers the freedom to innovate with their choice of tools, application stacks, and deployment environments for each project.

I personally like the idea of containers, but only in freight traffic (my line of business). If the goods were brought to the customer in the container, they are usually taken out of there again, since the container naturally severely restricts the functionality of the content.

In my opinion, the so-called advantages of Docker are completely lost with a dedicated server. In place of the here mentioned complexity, comes the complexity of playing around with the container content like with marionettes.

Anyone who feels like a fish in water in the server world, i.e. speaks at least bash and SQL freely and understands other languages, will quickly feel patronized with Docker. At least that’s how I feel.

Of course, I also use virtual machines and all kinds of container solutions, in the distant past I was involved in the development of Xen solutions myself, so I personally have nothing against such solutions. However, for home use, I rely on Barre Metal for those few servers that need to serve my dns, router, website, email, etc.
I can always intervene deep inside the processes, freedom of movement that I lack with docker and co.

But hey, that’s my very personal point of view.

Thank your for your answer.
The only reason why I started thinking about again moving away from Docker is actually the complexity it adds in my case.
I installed it on Docker, because I thought it would be simpler. Always up to date with Watchtower, and that’s it.
However, I wanted to add SMB shares to the base Nextcloud image, and found out I need smbclient. Said myself fine, there must be a simple way to do this. Not really… I would have to create my own image, and that is where it actually stops for me, because it exactly does the opposite: it introduces complexity.
Now, I could simply solve it by managing the SMB shares on the host, and then passing it through to the docker.
However I find myself asking what other features might Nextcloud need in the future…
And before I “lock” myself with even more functionality running through dockerized Nextcloud, I am thinking of going bare metal again.
Not saying Docker is bad though, I have another 10 containers running there, all of which are “simple” apps, which could run under windows or linux, but having them in Docker is in this case easier and simpler.
I don’t have the same feeling for Nextcloud.

I have completely different view on Docker then @ernolf - I use Docker since I started with NC 3 year ago… I would not say it always have been easy but I’m under impression it is easier than native install. I made 7 major upgrades already without big issues and without touching the host. I moved the installation from Docker running on Qnap NAS to x86 Debian host by basically file copy (no missing dependencies, modules, settings). Especially I like the possibility to run another instance of Nextcloud for testing - having traefik reverse proxy in front of it it is as simple as setup second docker-compose file for another domain and you have a second NC you can use to test version upgrades, test apps in advance… and you can very easy start from scratch if you messed up your test instance - remove your containers and you have really fresh installation without any traces of previous tests!

Depending on your setup new requirements like new PHP versions could become a headache on bare-metal (likely not in your case but in locked down enterprise environment when silly polices requires outdated PHP…) Running one application on a server will work without Docker as well. But it becomes harder when you try to host multiple application which might have different requirements (e.g. different PHP versions, same database type).

Definitely Docker adds complexity but at the same time it reduces complexity on other side… which part is more for you must decide yourself. The problem with smbclient is not such hard - GH ships an example with smb aleady not really big deal to build a custom container. Both variants sound suitable in your case I would recommend you choose the solution you are more comfortable with - if you work daily with Linux server administration without Docker - bare metal or VM would be likely the better choice… if you know and understand Docker already - no reason to switch. But if you actively looking for chance to learn specific technology then go for it!

1 Like

Hmm, interesting point of view.
I actually run this as a private cloud, no need for tests of devs, if it goes bonkers, I guess I would have to rebuild or restore it (yes, I have backups, running Veeam B&R). But I have no productive hurry or anything, so I could afford myself going days without Nextcloud. Uncool of course, but not destructive.
I am at a point where I will have to learn more about Dockers, since my new job will require it, so no point in delaying. However, I don’t have to force myself doing it with Nextcloud :wink:
Since I never built a custom container, all I ever did was use Portainer, and simply let it do it’s work. Only custom thing I did was create my custom docker compose file, which works well in redeploying a container, setting variables or volumes. Basically what is needed to deploy the container automatically and set everything so that it works. Custom images is a step further.
Additionally, I am no Linux admin, I merely can copy things from the web, I understand most of it, being a windows admin, however without some web tutorial, I would most likely be lost.

especially for SMB no need to scary about building your own image. this sounds more complicated than it is… for docker-compose: just save the example with SMB in your project directory nextcloud_with_smb and replace image: with build:

    # remove image directive
    #image: nextcloud:${NEXTCLOUD_VERSION}
    # add build directive
      context: .
      dockerfile: ./nextcloud_with_smb

this one of the beautiful side of Docker - you can adopt existing images very easy… there are downsides as well. e.g. working IPv6 support is pretty fresh…but now it’s there!

again this can be seen from different point of views. Nextcloud (especially if you build it right with DB, redis, notify_push, AV etc) is definitely not the easiest project to start and for this reason you might choose simpler project like a webserver or CMS… but if you master Nextcloud over longer period of time likely you gain pretty good understanding of running complex applications with Docker.

same applies for me… and while I definitely do backups for disaster as well I try to avoid such situations as result from my interaction e.g. upgrade. and for this reason I use a second instance without production data - only few test files for upgrade tests (Nextcloud is not the best in term of upgrades :wink: ) I use this instance to practice disaster recovery from time to time - as it holds only few files recovery is fast… there is no issues for my wife as another user of the cloud and I confirm my backup should work… this is definitely nothing everybody “must do” and not everybody “want” - but this is part of my Docker learning and part of my community engagement… again with Docker this second instance is a nobrainer - it doesn’t cost significant resources, administration effort is low - this my personal recommendation for everybody running Nextcloud in Docker.

Returning to the initial question personally I recommend Docker but depending on your goals nothing is wrong with bare-metal install if this is the only application running on your server.

I suspect the answer is probably you choose, flipping a coin if needed.#

I’ve used VMs for a long time, and currently have 2 live and 3 play Nextclouds running on Ubuntu VMs on a small office / home office server running the free version of ESXi.

Things I like about VMs
Lots of good doco about running linux in a VM.
SSH into the machine (our console login via a browser to ESXi) and you’ve got all the capabilities of a linux host at your disposal.
Full networking stack, directly on a subnet
You can very easily change things
Don’t need to mess about with persistence layers and orchestrating a bunch of related containers
RAM is my main constraint (if I want to avoid using swap on the ESXi)

Issues with VMs
Potential for dependency hell if you try to run multiple unrelated apps on a single VM. Just run up separate VMs for pity’s sake.
Snaps suck. Kill it with fire, of be forever expanding /var as it sucks down ever move versions of apps - which you have to trust the snap maker to have configured how you like.
You do need to run the OS as well as your apps which consumes RAM, even if CPU idles at 1% most of the time

Likes with Containers
Run multiple versions or instances of apps on the one host, with lower overhead as only 1 instance of the OS running - probably saves 256M of RAM per instance
You can run lots of instances of an app very efficiently on a much lower hardware footprint. Not applicable for a single NC instance of course.
Can be more resilient if you have multiple hosts - containers can be restarted elsewhere if a hosts fails without having to pay for vSphere
For hosting discrete apps at at scale, with the full management suite from AWS/Azure/GCP they are definately the way to go IF architected and managed properly.

Dislikes with Containers
Preserving state can be problematic - you need to mount filesystems from another service to save anything, which needs to come from somewhere reliable so hardware or VM.
Running connections between services over a network stack is relatively slow - all on a VM using pipes or sockets (or even localhost) is much quicker.
Some services are a PITA to run from a container due to networking.
Making containers still looks relatively complex
Too much reliance on “free” services to make containers really easy for small-time players/ Or you pay a premium to keep using them - and then keep paying forever.

Summing Up
I don’t have a rack of machines to play with, and running containers in a VM on a hypervisor on a single server seems like a lot of extra effort for no real benefit.

So in my case, I’m sticking with VMs, and I install NC manually (or via a master image I created) in under an hour so it’s not exactly onerous.

On my personal to-do list is to create a kubernetes cluster and have a really good play and maybe at that point I’ll try NC in a container. But that’s not likely to happen any time soon due to real life getting in the way.


Full disclosure: I’ve been playing with VM’s for over 15 years, had a brief play with Solaris containers at about the same time (it was problematic in many ways, but it did actually work) and have been getting a good look at Kubernetes architecture in the last few months but probably won’t (and shouldn’t!) be allowed to play with production workloads any time soon. But I have all the icons on a ppt…


Richard, many thanks for your post, actually was very useful. And helped me decide:

Not mine (running 128GB, and still 53GB free). So a plus for me. Even thought of expanding to 256GB.
All other points also positive for me.

Not running permanent snapshots. Veeam Backup is doing weekly incremental backup, and soon, when I have my Synology dedicated to backups, monthly fulls. Snapshots are only for upgrades, so if f**k something up… and even then, backup exists.

RAM not an issue…

No need for multiple instances. And even if I ever get the need, I can spin up containerized version of Nextcloud beside my standalone VM.

No multiple hosts. Just a single ESXi at home. It has some nested stuff on it, running my windows domain there etc, but everything is actually on a single 2TB NVME. A good single point of failure. Thus backups. Even thinking of running some servers daily…

Since I am not going to go that way yet… I am first doing lots of videos around dockers, and I can learn with other apps than my productive ones.

Not that it most likely matters in my case, but it’s a plus for a VM.

And that is the way that I am going to go - again.
Besides, I will implement Ansible in coming months, so I will have a chance at using it for updating, management and maybe even standardized deployment (as I said, something I need to learn until the end of the year). Or as you said, master-image. Besides, nothing bad at learning Linux and components more.

So, while @wwe Willi does have many valid points around additional instances, I am no dev. I don’t need that. I have to learn Docker, that is true, but I don’t have to use Nextcloud for that. In case of NC, I really need a “finished” platform that I can use, and preferably inside of next couple of days.

Thanks for helping out everything, the path is clear for me: bare metal (a dedicated virtual machine).

1 Like

one big bonus for docker is: distributions like debian tend to provide old PHP versions - using docker you can chose predefined nextcloud images with the correct PHP version without need to touch the base system.
Another one: if you feel your performance gets down, you can easily move components to other platforms, like the database container or your directory server or redis or whatever.
Just another one: you have better control over which ports you open for which container.
Or, one more: when you like to setup just another web application on the same machine, concepts like traefik allow you to easily do so without touching the nginx/apache of nextcloud. You can have completely different web server platforms (nginx, apache, …) with completely different configurations on the same machine.

1 Like

Indeed, you are right. However, having bare metal allows me to use whatever PHP version I desire, very easily. And I am sure for someone who knows how to move around custom docker images, this is a trivial matter, and in fact, I might also be doing that if I had the experience.
However, running bare metal, is for me, with my single instance, all the same thing, just that I need couple of GB disk space and couple of GB RAM extra. Cloning, snapshots and backups are for me an easy task.

Or rebuild the image, sorry, I mean server… it’s the same thing, no? I have no other platforms, I have my 4U server, running ESXi, and this is where my stuff is. Won’t be running Nextcloud from my laptop…

For sure, you have additional security barrier. Mine is firewall and VLANs. Kinda the same thing.

For my purpose, Nextcloud will have it’s own server, nothing else on it.
Actually built the VM, but I think I’ll try even with Ubuntu minimal install to reduce the footprint.

All your points are valid, but for Docker in general, not necessarily for Nextcloud. Which is fine. As I said, I have couple of Docker containers on my Docker-Host, and they will remain, since they are way simpler and will never need some addons. In this case I find Docker completely right.

1 Like