this post was submitted on 11 Mar 2024
152 points (94.2% liked)

Selfhosted

37779 readers
244 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
 

I never understood how to use Docker, what makes it so special? I would really like to use it on my Rapsberry Pi 3 Model B+ to ease the setup process of selfhosting different things.

I'm currently running these things without Docker:

  • Mumble server with a Discord bridge and a music bot
  • Maubot, a plugin-based Matrix bot
  • FTP server
  • Two Discord Music bots

All of these things are running as systemd services in the background. Should I change this? A lot of the things I'm hosting offer Docker images.

It would also be great if someone could give me a quick-start guide for Docker. Thanks in advance!

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

There have been some great answers on this so far, but I want to highlight my favourite part of Docker: the disposability.

When you have a running Docker container, you can hop in, fuck about with files, break stuff as you try to figure something out, and then kill the container and all of the mess you've created is gone. Now tweak your config and spin up a fresh one exactly the way you need it.

You've been running a service for 6 months and there's a new upgrade. Delete your instance and just start up the new one. Worried that there might be some cruft left over from before? Don't be! Every new instance is a clean slate. Regular, reproducible deployments are the norm now.

As a developer it's even better: the thing you develop locally is identical to the thing that's built, tested, and deployed in CI.

I <3 Docker!

[–] [email protected] 5 points 3 months ago (4 children)

What about your preferences/configs/files (when you spun up a fresh one)?

[–] [email protected] 10 points 3 months ago (1 children)

The most popular way of configuring containers are by using environment variables that live outside the container. But for apps that use files to store configuration, you can designate directories on your host that will be available inside the container (called "volumes" in Docker land). It's also possible to link multiple containers together, so you can have a database container running alongside the app.

[–] [email protected] 4 points 3 months ago (1 children)

If you have all of that set up then, what benefit is there to blowing away your container and spinning up a 'fresh' one? I've never been able to wrap my head around docker, and I think this is a big part of it.

[–] [email protected] 5 points 3 months ago (1 children)

There's a lot more to an application than its configuration. It may require certain specific system libraries, need a certain way of starting up, or a whole host of other special things. With a container, the app dev can precreate a perfect environment for their program and save you LOADS of hassle trying to set it up.

The benefit of all this is that you can know exactly where application state is stored, know that you're running the app in it's right environment, and it becomes turbo easy to install updates, or roll back if needed.

Totally spin up a VM, install docker on it, and deploy 2-3 web apps. You'll notice that you use the same way of configuring them, starting and stopping them, and you might not want to look back ;)

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

I've played with it a bit. I think I was using something called DockStarter and Portainer. Like I said though, I could never quite grasp what was going on. Now for my home webapps I use Yunohost, and for my media server I use Swizzin CE. I've found these to be a lot easier, but I will try Docker again sometime.

load more comments (2 replies)
load more comments (2 replies)