Hi! Im new to self hosting. Currently i am running a Jellyfin server on an old laptop. I am very curious to host other things in the future like immich or other services. I see a lot of mention of a program called docker.
search this on The internet I am still
Not very clear what it does.
Could someone explain this to me like im stupid? What does it do and why would I need it?
Also what are other services that might be interesting to self host in The future?
Many thanks!
EDIT: Wow! thanks for all the detailed and super quick replies! I've been reading all the comments here and am concluding that (even though I am currently running only one service) it might be interesting to start using Docker to run all (future) services seperately on the server!
Wow! Thank you all for the civilized responses. This all sounds so great. I am older and I feel like I've already seen enough ads for one lifetime and I hate all this fascist tracking crap.
But how does that work? Is it just a network on which you store your stuff in a way that you can download it anywhere or can it do more? I mean, to me that's just a home network. Hosting sounds like it's designed for other people to access. Can I put my website on there? If so, how do I go about registering my domain each year. I'm not computer illiterate but this sounds kind of beyond my skill level. I'll go search Jellyfin, weird name, and see what I can find. Thanks again!
You're asking a lot of questions at one time and will be better served understanding you're knocking at the door of a very deep rabbit hole.
That said, I'll try to give you the basic idea here and anyone who can correct me, please do so! I doubt I'll get everything correct and will probably forget some stuff lol.
So, self hosting really just means running the services you use on your own machine. There's some debate about whether hosting on a cloud server - where someone else owns and has physical access to the machine - counts as self hosting. For the sake of education, and because I'm not a fan of gatekeeping, I say it does count.
Anyway, when you're running a server (a machine, real or virtualized, that is running a program connected to a network that can - usually - be accessed by other machines connected to that network), who and what you share with other machines on your network or other networks, is ultimately up to you.
When using a "hosted" service, which is where another entity manages the server (not just the hardware, but the software and administration too, and is therefore the opposite of self hosting. Think Netflix, as opposed to Jellyfin), your data and everything you do on or with that service on that network belongs to the service provider and network owners. Your "saved" info is stored on their disks in their data center. There are of course exceptions and companies who will offer better infrastructure and privacy options but that's the gist of non-self-hosted services.
To your specific questions:
But how does that work?
Hopefully the above helps, but this question is pretty open ended lol. Your next few questions are more pointed, so I'll try to answer them better.
Is it just a network on which you store your stuff in a way that you can download it anywhere or can it do more?
Well, kind of. If you're hosting on a physical machine that you own, your services will be accessible to any other machine on your home network (unless you segment your network, which is another conversation for another time) and should not, by default, be accessible from the internet. You will need to be at home, on your own network to access anything you host, by default.
As for storage of your data, self hosted services almost always default to local storage. This means, you can save anything you're doing on the hard-drive of the machine the server is running on. Alternatively if you have a network drive, you can store it on another machine on your network. Some services will allow you to connect to cloud storage (on someone else's machine somewhere else). The beauty is that you decide where your data lives.
I mean, to me that's just a home network. Hosting sounds like it's designed for other people to access. Can I put my website on there?
Like almost anything with computers and networking, the defaults are changeable. You can certainly host a service on the internet for others to access. This usually involves purchasing the rights to a domain name, setting that domain up to link to your private IP address, and forwarding a port on your router so people can connect to your machine. This can be extremely dangerous if you don't know what you're doing an isn't recommended without learning a lot more about network and cyber security.
That said, there are safer ways to connect from afar. Personally, I use a software called Wireguard. This software allows devices I approve (like my phone, or my girlfirend's laptop) to connect to my network when away from home though what is called an "encrypted tunnel" or a "Virtual Private Network (VPN) ". These can be a pain to set up for the first time if you're new to the tech and there are easier solutions I've heard of but haven't tried, namely Tailscale, and Netbird, both of which use Wireguard but try to make the administration easier.
You can also look into reverse proxies, and services like cloudflare for accessing things away from home. These involve internet hostng, and security should be considered, like above. Anything that allows remote access will come with unique pros and cons that you'll need to weigh and sort for yourself.
If so, how do I go about registering my domain each year.
Personally, I use Porkbun.com for cheap domains, but there are tons of different providers. You'll just have to shop around. To actually use the domain, I'm gonna be linking some resources lower in the post. If I remember correctly, landchad.net was a good resource for learning about configuring a domain but idk. There will be a few links below.
I'm not computer illiterate but this sounds kind of beyond my skill level.
It was beyond my skill level when I started too. It's been nearly a year now and I have a service that automatically downloads media I want, such as movies, shows, music, and books. It stores them locally on a stack of hard drives, I can access them outside of my house with wireguard as well. Further, I've got some smaller services, like a recipe book I share with my girlfriend and soon with friends and family. I've also started hosting my own AI, a network wide ad-blocker, a replacement for Google photos, a filesharing server, and some other things that are escaping me right now.
The point is that it's only a steep hill while you're at the bottom looking up. Personally, the hike has been more rejuvenating than tiresome, though I admit it takes patience, a bit of effort, and a willingness to learn, try new things, and fail sometimes.
Never sweat the time it takes to accomplish a task. The time will pass either way and at the end of it you can either have accomplished something, or you'll look back and say, "damn I could've been done by now."
I'll go search Jellyfin, weird name, and see what I can find. Thanks again!
Trash Guides (for automation of downloads for Jellyfin. I'll leave the morality of how you acquire media for you to decide): https://trash-guides.info/
Tim Kye blog (useful stuff here, especially if you use proxmox): https://blog.kye.dev/
Docker enables you to create instances of an operating system running within a “container” which doesn’t access the host computer unless it is explicitly requested. This is done using a Dockerfile, which is a file that describes in detail all of the settings and parameters for said instance of the operating system. This might be packages to install ahead of time, or commands to create users, compile code, execute code, and more.
This is instance of an operating system, usually a “server,” is great because you can throw the server away at any time and rebuild it with practically zero effort. It will be just like new. There are many reasons to want to do that; who doesn’t love a fresh install with the bare necessities?
On the surface (and the rabbit hole is deep!), Docker enables you to create an easily repeated formula for building a server so that you don’t get emotionally attached to a server.
Now compare Docker vs LXC vs Chroot vs Jails and the performance and security differences. I feel a lot of people here are biased without knowing the differences (pros and cons).
A program isn't just a program: in order to work properly, the context in which it runs — system libraries, configuration files, other programs it might need to help it such as databases or web servers, etc. — needs to be correct. Getting that stuff figured out well enough that end users can easily get it working on random different Linux distributions with arbitrary other software installed is hard, so developers eventually resorted to getting it working on their one (virtual) machine and then just (virtually) shipping that whole machine.
It's not. Imagine Immich required library X to be at Y version, but another service on the server requires it to be at Z version. That will be a PitA to maintain, not to mention that getting a service to run at all can be difficult due to a multitude of reasons in which your system is different from the one where it was developed so it might just not work because it makes certain assumptions about where certain stuff will be or what APIs are available.
Docker eliminates all of those issues because it's a reproducible environment, so if it runs on one system it runs on another. There's a lot of value in that, and I'm not sure which resource you think is being wasted, but docker is almost seamless without not much overhead, where you won't feel it even on a raspberry pi zero.
If it were actual VMs, it would be a huge waste of resources. That’s really the purpose of containers. It’s functionally similar to running a separate VM specific to every application, except you’re not actually virtualizing an entire system like you are with a VM. Containers are actually very lightweight. So much so, that if you have 10 apps that all require database backends, it’s common practice to just run 10 separate database containers.
The main "wasted" resources here is storage space and maybe a bit of RAM, actual runtime overhead is very limited. It turns out, storage and RAM are some of the cheapest resources on a machine, and you probably won't notice the extra storage or RAM usage.
VMs are heavy, Docker containers are very light. You get most of the benefits of a VM with containers, without paying as high of a resource cost.
On the contrary. It relies on the premise of segregating binaries, config and data. But since it is only running one app, then it is a bare minimum version of it. Most containers systems include elements that also deduplicate common required binaries. So, the containers are usually very small and efficient. While a traditional system's libraries could balloon to dozens of gigabytes, pieces of which are only used at a time by different software. Containers can be made headless and barebones very easily. Cutting the fat, and leaving only the most essential libraries. Fitting in very tiny and underpowered hardware applications without losing functionality or performance.
Don't be afraid of it, it's like Lego but for software.
I've had immich running in a VM as a snap distribution for almost a year now and the experience has been leaps and bounds easier than maintaining my own immich docker container. There have been so many breaking changes over the few years I've used it that it was just a headache. This snap version has been 100% hands off "it just works".
You might notice that your Windows installation is like 30 gigabytes and there is a huge folder somewhere in the system path called WinSXS. Microsoft bends over backwards to provide you with basically all the versions of all the shared libs ever, resulting in a system that can run programs compiled from decades ago just fine.
In Linux-land usually we just recompile all of the software from source. Sometimes it breaks because Glibc changed something. Or sometimes it breaks because (extremely rare) the kernel broke something. Linus considers breaking the userspace API one of the biggest no-nos in kernel development.
Even so, depending on what you're doing you can have a really old binary run on your Linux computer if the conditions are right. Windows just makes that surface area of "conditions being right" much larger.
As for your phone, all the apps that get built and run for it must target some kind of specific API version (the amount of stuff you're allowed to do is much more constrained). Android and iOS both basically provide compatibility for that stuff in a similar way that Windows does, but the story is much less chaotic than on Linux and Windows (and even macOS) where your phone app is not allowed to do that much, by comparison.
In case of phones, there's less of a myriad of operating systems and libraries.
A typical Android app is (eventually) Java with some bundled dependencies and ties in to known system endpoints (for stuff like notifications and rendering graphics).
For windows these installers are usually responsible for getting the dependencies. Which is why some installers are enormous (and most installers of that size are web installers, so it looks smaller).
Docker is more aimed at developers and server deployment, you don't usually use docker for desktop applications. This is the area where you want to skip inconsistencies between environments, especially if these are hard to debug.
Caveat: I am not a programmer, just an enthusiast. Windows programs typically package all of the dependency libraries up with each individual program in the form of DLLs (dynamic link library). If two programs both require the same dependency they just both have a local copy in their directory.
So instead of having problems getting the fucking program to run, you have problems getting docker to properly build/run when you need it to.
At work, I have one program that fails to build an image because of a 3rd party package who forgot to update their pgp signature; one that builds and runs, but for some reason gives a 404 error when I try to access it on localhost; one that whoever the fuck made it literally never ran it, because the Dockerfile was missing some 7 packages in the apt install line.
There are two ends here, as a user and as a developer. As a user Docker images just work, so you solve almost every problem you're having which would be your users having them and giving up on using your software.
Then as a developer docker can get complicated, because you need to build a "system" from scratch to run your program. If you're using an unstable 3d party package or missing packages it means that those problems would be happening in the deploy servers instead of your local machines, and each server would have its own set of problems due to which packages they didn't have or had the wrong version, and in fixing that for your service you might be breaking other service already running there.
Yeah, it's another layer, and so there definitely is an https://xkcd.com/927/ aspect to it... but (at least in theory) only having problems getting Docker (1 program) to run is better than having problems getting N problems to run, right?
Building from source is always going to come with complications. That's why most people don't do it. A docker compose file that 'just' downloads the stable release from a repo and starts running is dramatically more simple than cross-referencing all your services to make sure there are no dependency conflicts.
There's an added layer of complexity under the hood to simplify the common use case.
EDIT: Wow! thanks for all the detailed and super quick replies! I've been reading all the comments here and am concluding that (even though I am currently running only one service) it might be interesting to start using Docker to run all (future) services seperately on the server!
This is pretty much what I've started doing. Containers have the wonderful benefit that if you don't like it, you just delete it. If you install on bare metal (at least in Linux) you can end up with a lot of extra packages getting installed and configured that could affect your system in the future. With containers, all those specific extras are bundled together and removed at the same time without having any effect on your base system, so you're always at your clean OS install.
I will also add an irritation with docker containers as well, if you create something in a container that isn't kept in a shared volume, it gets destroyed when starting the container again. The container you use keeps the maintainers setup, for instance I do occasional encoding of videos in a handbrake container, I can't save any profiles I make within that container because it will get wiped next time I restart the container since it's part of the container, not on any shared volume.
Please don't call yourself stupid. The common internet slang for that is ELI5 or "explain [it] like I'm 5 [years old]".
I'll also try to explain it:
Docker is a way to run a program on your machine, but in a way that the developer of the program can control.
It's called containerization and the developer can make a package (or container) with an operating system and all the software they need and ship that directly to you.
You then need the software docker (or podman, etc.) to run this container.
Another advantage of containerization is that all changes stay inside the container except for directories you explicitly want to add to the container (called volumes).
This way the software can't destroy your system and you can't accidentally destroy the software inside the container.
I know it's ELI5, but this is a common misconception and will lead you astray. They do not have the same level of isolation, and they have very different purposes.
For example, containers are disposable cattle. You don't backup containers. You backup volumes and configuration, but not containers.
Containers share the kernel with the host, so your container needs to be compatible with the host (though most dependencies are packaged with images).
For self hosting maybe the difference doesn't matter much, but there is a difference.
Docker is a set of tools, that make it easier to work with some features of the Linux kernel. These kernel features allow several degrees of separating different processes from each other. For example, by default each Docker container you run will see its own file system, unable to interact (read: mess) with the original file system on the host or other Docker container. Each Docker container is in the end a single executable with all its dependencies bundled in an archive file, plus some Docker-related metadata.
It’s a container service. Containers are similar to virtual machines but less separate from the host system. Docker excels in creating reproducible self contained environments for your applications. It’s not the simplest solution out there but once you understand the basics it is a very powerful tool for system reliability.
I've never posted on Lemmy before. I tried to ask this question of the greater community but I had to pick a community and didn't know which one. This shows up as lemmy.world but that wasn't an option.
Anyway, what I wanted to know is why do people self host? What is the advantage/cost. Sorry if I'm hijacking. Maybe someone could just post a link or something.
People are talking about privacy but the big reason is that it gives you, the owner, control over everything quickly without ads or other uneeded stuff. We are so used to apps being optomized for revenue and not being interoperable with other services that it's easy to forget the single biggest advantage of computers which is that programs and apps can work together quickly and quietly and in the background. Companies provide products, self-hosting provides tools.
Anyway, what I wanted to know is why do people self host?
Wow. That's a whole separate thread on it's on. I selfhost a lot of my services because I am a staunch privacy advocate, and I really have a problem with corporations using my data to further bolster their profit margins without giving me due compensation. I also self host because I love to tinker and learn. The learning aspect is something I really get in to. At my age it is good to keep the brain active and so I self host, create bonsai, garden, etc. I've always been into technology from the early days of thumbing through Pop Sci and Pop Mech magazines, which evolved into thumbing through Byte mags.
Anyway, what I wanted to know is why do people self host?
For the warm and fuzzy feeling I get when I know all my documents, notes, calendars, contacts, passwords, movies/shows/music, videos, pictures and much more are stored safely in my basement and belong to me.
Nobody is training their AI on it, nobody is trying to use them for targetted ads, nobody is selling them. Just for me.
Containerized software. The main advantage of this is that every application, or stack of applications, runs in its own ecosystem. You can restart a container whenever without having to reboot your entire system. You can store all data off a container in a volume, so if you hit a snag, you can recreate the container without actually losing any of your configs.
You can also create networks so that apps run in different subnets than other apps.
Very simply put, a docker container is like a mini system that runs on your main system.
Something else I like about docker is docker compose. You can create a container or stack of containers with a single simple YAML file without actually having to install anything yourself. I manage my containers in Portainer.
I'm not sure how familiar you are with computers in general, but I think the best way to explain Docker is to explain the problem it's looking to solve. I'll try and keep it simple.
Imagine you have a computer program. It could be any program; the details aren't important. What is important, though, is that the program runs perfectly fine on your computer, but constantly errors or crashes on your friend's computer.
Reproducibility is really important in computing, especially if you're the one actually programming the software. You have to be certain that your software is stable enough for other people to run without issues.
Docker helps massively simplify this dilemma by running the program inside a 'container', which is basically a way to run the same exact program, with the same exact operating system and 'system components' installed (if you're more tech savvy, this would be packages, libraries, dependencies, etc.), so that your program will be able to run on (best-case scenario) as many different computers as possible. You wouldn't have to worry about if your friend forgot to install some specific system component to get the program running, because Docker handles it for you. There is nuance here of course, like CPU architecture, but for the most part, Docker solves this 'reproducibility' problem.
Docker is also nice when it comes to simply compiling the software in addition to running it. You might have a program that requires 30 different steps to compile, and messing up even one step means that the program won't compile. And then you'd run into the same exact problem where it compiles on your machine, but not your friend's. Docker can also help solve this problem. Not only can it dumb down a 30-step process into 1 or 2 commands for your friend to run, but it makes compiling the code much less prone to failure. This is usually what the Dockerfile accomplishes, if you ever happen to see those out in the wild in all sorts of software.
Also, since Docker puts things in 'containers', it also limits what resources that program can access on your machine (but this can be very useful). You can set it so that all the files it creates are saved inside the container and don't affect your 'host' computer. Or maybe you only want to give permission to a few very specific files. Maybe you want to do something like share your computer's timezone with a Docker container, or prevent your Docker containers from being directly exposed to the internet.
There's plenty of other things that make Docker useful, but I'd say those are the most important ones--reproducibility, ease of setup, containerization, and configurable permissions.
One last thing--Docker is comparable to something like a virtual machine, but the reason why you'd want to use Docker over a virtual machine is much less resource overhead. A VM might require you to allocate gigabytes of memory, multiple CPU cores, even a GPU, but Docker is designed to be much more lightweight in comparison.
If the app does bad, it doesn't sink your ship. Just throw the box over board and repackage the app.
I'm not sure most people need it, but it could be fun to use a new app inside a container. Also makes updating that needs a restarting without shutting down your other services.
good answers already so i will give you a different example.
my basic understanding of it is that docker was created originally for developers. im not sure if anyone planned for it to be a way to package up software for end users.
before docker existed you would have this issue where devs would be working on an app, say jellyfin, but each dev might be on a different platform (windows, mac, linux), or be using a different OS version, or different versions of whatever software... which meant it happened often that the app would work for one dev but not another. maybe one dev updated C# to version 2.3 and told everyone else to update, but someone missed the memo and is still running version 2.2 and now jellyfin wont work for them and time would be wasted trying to figure out where the mismatch was
so docker was a way to fix that "version hell" problem. every single thing that is needed for the app to run is kept inside the container. one dev will update something to a new version, then that container is shared to all other devs and each dev only has to worry about updating to the newest container before they start working on something.
app settings are kept in a separate location and the app data in another. in the case of jellyfin, the app data would be the movies or tv shows folder for example. then when you start the docker container, it will symlink those 2 locations/folders inside the container and the jellyfin app can access them as if they were folders that were actually stored inside the container.
so having the settings and data separate like that makes it very easy to update the container to a new version, or for a developer is probably useful being able to rollback to an older container for testing. its similar to how say windows puts the program files in one location and settings in the appdata folder
for end users its handy if theres a new version of jellyfin or whatever that isnt released yet but you want try it out, you can run 2 containers at the same time and both of them can access the same settings and data. (maybe with the newer one in read-only mode so it doesnt mess up your settings or data!)
You can think of Docker as something that lets you run all of your self-hosted services inside of their own virtual machine. To each service, it looks like that service is running on its own separate computer. (A Docker container is not actually a virtual machine, it's something much faster than that, but I like to think about it the same way. It has similar advantages.)
This has a few advantages. For example, if there is a security vulnerability in one of your services, it's less likely to affect your whole server if that vulnerable service is inside of a Docker container. Even if the vulnerability lets an attacker see files on your system, the only "system" they can see is the one inside of the Docker container. They can't look at anything else on the rest of your actual computer, they can only see the Docker "virtual machine" that you created for that one service.