this post was submitted on 18 Jan 2024
10 points (81.2% liked)

Selfhosted

40199 readers
589 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hi, I'm just getting started with Docker, so apologies in advance if this seems silly.

I used to self-host multiple services (RSS reader, invoicing software, personal wiki) directly on a VPS using nginx and mariadb. I messed it up recently and am starting again, but this time I took the docker route.

So I've set up the invoicing software (InvoiceNinja), and everything is working as I want.

Now that I want to add the other services (ttrss and dokuwiki), should I set up new containers? It feels wasteful.

Instead, if I add additional configs to the existing servers that the InvoiceNinja docker-compose generated (nginx and mysql), I'm worried that an update to Invoiceninja would have a chance of messing up the other setups as well.

It shouldn't, from my understanding of how docker containers work, but I'm not 100% sure. What would be the best way to proceed?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 10 months ago (1 children)

Aren't containers the product of compose files? i.e. the compose files spin up containers. I understand the architecture, I'm just not sure about how docker streamlines separate containers running the same process (eg, mysql).

I'm getting some answers saying that it deduplicates, and others saying that it doesn't. It looks more likely that it's the former though.

[–] [email protected] 1 points 10 months ago

A compose file is just the configuration of one or many containers. The container is downloaded from the chosen registry and pretty much does not get touched.

A compose file 'composes' multiple containers together. Thats where the name comes from.

When you run multiple databases then those run parallel. So every database has its own processes. You can even see them on the host system by running something like top or htop. The container images themself can get deduplicated that means that container images that contain the same layer just use the already downloaded files from that layer. A layer is nothing else as multiple files bundled. For example you can choose a 'ubuntu layer' for the base of your container image and every container that you want to download using that same layer will just simply use those files on creation time. But that basically does not matter. We are talking about a few 10th or 100th of MB in extreme cases.

But important, thoses files are just shared statically and changing a file in one container does not affect the other. Every container has its own isolated filesystem.

I understand the architecture, I'm just not sure about how docker streamlines separate containers running the same process (eg, mysql).

Quite simple actually. It gives every container its own environment thats to namespacing. Every process thinks (more or less) it is running on its own machine.

There are quite simple docker implementations with just a couple of hundreds lines of code.