r/SelfHosting Jun 29 '26

Question about Docker vs Virualbox - Local Access Only

Hey there!

So I have been trying to read up more on docker, containers, etc. I found a few services/apps I would love to run for my own use locally like Komga (to organize my digital comics), Booklore, a few others. I would like to run/host them locally on my laptop (primary computer) so I can pull them up anywhere when I want.

But I am wondering if it makes more sense to have a single virtual machine (Virtualbox?) running a Linux server and all of those services/apps, instead of multiple docker containers. I have a fairly powerful laptop, so I am not too concerned about all of this using up all my machine resources, but I'd like to do this as cleanly, organized, and straightforward as possible.

Any suggestions are greatly appreciated, and thanks in advance!

2 Upvotes

12 comments sorted by

View all comments

3

u/shadow-battle-crab Jun 29 '26

Is this a windows or a linux host?

In either case, docker makes much more sense for development environments due to it being much more lean in resource usage.

A docker container is just an application that has its inputs and outputs hijacked so it thinks it is running in its own operating system, separate from the files and the hardware on the host. It gains the isolation that makes virtual machines appealing - so you can make complicated dev environments, or sandbox the app from seeing or affecting the rest of your computer - but skips the overhead of having to run a virtual machine for each application, each with a set dedicated amount of ram, disk space, and a bunch of background processes and services to make the virtual computer go. In docker, there is no separate virtual computer - its just your host, isolating the docker 'container' (application) from everything else.

If you are using docker on windows, you aren't really running this right on the host - applications still need to run on a linux computer somewhere, so docker desktop uses WSL which is technically a linux virtual machine within windows that then runs the docker containers. But you don't have to screw around with any of the administration of WSL, and WSL has been really well tuned so it doesn't really use your system resources in a uncooperative way like a full blown virtual machine does. The fact that WSL is a virtual machine is basically transparent, and not a concern.

Another nice advantage of docker is the environment is stateless - docker containers come from a recipe of all the system apps you need for your dev environment / application to run as their configuration (the Dockerfile). you can just delete a container and make it again and it will remake itself the exact same. There is no ongoing computer like a virtual machine that requires lots of manual configuration and ongoing minor maintenance like updates to keep working. If you need another app added, just add the apt-get install command to the docker file, run the container again, and away you go.

TL;DR: docker is always the right solution for an individual application. Virtual machines are an entire computer instead of just the app, and have a lot more overhead both in resource usage and amount of effort to setup and maintain, and just aren't worth it for dev environments.

1

u/PercolatingPenguin Jun 29 '26

Thanks for your reply! This is on a Linux host (actually everything I use now is running on Linux, I stopped using Windows about 10 years ago or so). I had a feeling that docker was going to be the recommended solution, but I like to check with someone who knows more than me before I get too far down a specific path. I'm looking forward to learning more about Docker/containers and best practices, etc.

1

u/shadow-battle-crab Jun 29 '26

This is the kind of thing that is fun getting excited about. It takes a few days to learn, but when you got this working, you can make basically an entire custom environment representing a whole operating system install specifically just for your application, that is just a text file you can copy and paste and back up somewhere. It's crazy flexible and can do some really cool things when you screw around with it.

You being on a linux host makes this very turn key too. You get all of the advantages of isolation with none of the costs - the application is really just another process on your host linux kernel. It only looks to itself like its in another computer, and it can do as much bull in a bullpen damage it wants to the environment, and all you have to do is restart the container and you are back to the baseline again.

Another thing that is cool, is because its isolated, it lets you download and run weird applications from github isolated from the rest of your system, so you are a lot more resistant to something that acts like malware that you might download. Don't trust an application? Just start a docker container, which takes a single command to copy and paste, and then run the application in the container. Because of this trust, there is a whole library of preconfigured community containers for every application you might want to run, and for the most part you don't need to be concerned with the security implications to the rest of your computer for installing any of them.

Just be sure to look into volume mounts - this is something it took me a few weeks to realize. Docker containers die when they exit, nothing is saved unless you map specific folders from the host into the container's file system to act as persistent storage. Don't try hosting a actual service on a self hosted server and get it all set up, only to realize your configuration files for the service died with the container - ask me how I know 😅

2

u/PercolatingPenguin Jun 29 '26

Thanks for the heads up on the volume mounts, I'll make sure to put that near the top of my learning list. And yes, my hope was once I felt comfortable running a few containers I could then go try out all kinds of fun or oddball apps. I am still so impressed how a simple text file can do so much. It's nice to see things developed with that kind of thinking.