this post was submitted on 13 Dec 2023
234 points (98.0% liked)

Selfhosted

40329 readers
426 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'm a retired Unix admin. It was my job from the early '90s until the mid '10s. I've kept somewhat current ever since by running various machines at home. So far I've managed to avoid using Docker at home even though I have a decent understanding of how it works - I stopped being a sysadmin in the mid '10s, I still worked for a technology company and did plenty of "interesting" reading and training.

It seems that more and more stuff that I want to run at home is being delivered as Docker-first and I have to really go out of my way to find a non-Docker install.

I'm thinking it's no longer a fad and I should invest some time getting comfortable with it?

you are viewing a single comment's thread
view the rest of the comments
[–] originalucifer@moist.catsweat.com 65 points 11 months ago (2 children)

dude, im kinda you. i just jumped into docker over the summer... feel stupid not doing it sooner. there is just so much pre-created content, tutorials, you name it. its very mature.

i spent a weekend containering all my home services.. totally worth it and easy as pi[hole] in a container!.

[–] GreatBlueHeron@lemmy.ca 25 points 11 months ago* (last edited 11 months ago) (2 children)

Well, that wasn't a huge investment :-) I'm in..

I understand I've got LOTS to learn. I think I'll start by installing something new that I'm looking at with docker and get comfortable with something my users (family..) are not yet relying on.

[–] infeeeee@lemm.ee 26 points 11 months ago (4 children)

Forget docker run, docker compose up -d is the command you need on a server. Get familiar with a UI, it makes your life much easier at the beginning: portainer or yacht in the browser, lazy-docker in the terminal.

[–] ChapulinColorado@lemmy.world 22 points 11 months ago* (last edited 11 months ago) (1 children)

I would suggest docker compose before a UI to someone that likes to work via the command line.

Many popular docker repositories also automatically give docker run equivalents in compose format, so the learning curve is not as steep vs what it was before for learning docker or docker compose commands.

[–] ARNiM@lemmy.world 4 points 11 months ago

There is even a tool to convert Docker Run commands to a Docker Compose file :)

Such as this one hosted by Opnxng:

https://it.opnxng.com/docker-run-to-docker-compose-converter

[–] damnthefilibuster@lemmy.world 6 points 11 months ago

Second this. Portainer + docker compose is so good that now I go out of my way to composerize everything so I don’t have to run docker containers from the cli.

[–] GreatBlueHeron@lemmy.ca 3 points 11 months ago* (last edited 11 months ago) (2 children)
# docker compose up -d
no configuration file provided: not found
[–] infeeeee@lemm.ee 4 points 11 months ago (1 children)

like just docker run by itself, it's not the full command, you need a compose file: https://docs.docker.com/engine/reference/commandline/compose/

Basically it's the same as docker run, but all the configuration is read from a file, not from stdin, more easily reproducible, you just have to store those files. The important is compose commands are very important for selfhosting, when your containers expected to run all the time.

RTFM: https://docs.docker.com/compose/

[–] GreatBlueHeron@lemmy.ca 5 points 11 months ago

Yeah, I get it now. Just the way I read it the first time it sounded like you were saying that was a complete command and it was going to do something "magic" for me :-)

[–] ssdfsdf3488sd@lemmy.world 1 points 10 months ago

you need to create a docker-compose.yml file. I tend to put everything in one dir per container so I just have to move the dir around somewhere else if I want to move that container to a different machine. Here's an example I use for picard with examples of nfs mounts and local bind mounts with relative paths to the directory the docker-compose.yml is in. you basically just put this in a directory, create the local bind mount dirs in that same directory and adjust YOURPASS and the mounts/nfs shares and it will keep working everywhere you move the directory as long as it has docker and an available package in the architecture of the system.

`version: '3' services: picard: image: mikenye/picard:latest container_name: picard environment: KEEP_APP_RUNNING: 1 VNC_PASSWORD: YOURPASS GROUP_ID: 100 USER_ID: 1000 TZ: "UTC" ports: - "5810:5800" volumes: - ./picard:/config:rw - dlbooks:/downloads:rw - cleanedaudiobooks:/cleaned:rw restart: always volumes: dlbooks: driver_opts: type: "nfs" o: "addr=NFSSERVERIP,nolock,soft" device: ":NFSPATH"

cleanedaudiobooks: driver_opts: type: "nfs" o: "addr=NFSSERVERIP,nolock,soft" device: ":OTHER NFSPATH" `

[–] ssdfsdf3488sd@lemmy.world 1 points 10 months ago

dockge is amazing for people that see the value in a gui but want it to stay the hell out of the way. https://github.com/louislam/dockge lets you use compose without trapping your stuff in stacks like portainer does. You decide you don't like dockge, you just go back to cli and do your docker compose up -d --force-recreate .

[–] monkeyman512@lemmy.world 4 points 11 months ago

If you are interested in a web interface for management check out portainer.

[–] themurphy@lemmy.world 8 points 11 months ago (3 children)

As a guy who's you before summer.

Can you explain why you think it is better now after you have 'contained' all your services? What advantages are there, that I can't seem to figure out?

Please teach me Mr. OriginalLucifer from the land of MoistCatSweat.Com

[–] BeefPiano@lemmy.world 23 points 11 months ago

No more dependency hell from one package needing libsomething.so 5.3.1 and another service absolutely can only run with libsomething.so 4.2.0

That and knowing that when i remove a container, its not leaving a bunch of cruft behind

[–] constantokra@lemmy.one 12 points 11 months ago

You can also back up your compose file and data directories, pull the backup from another computer, and as long as the architecture is compatible you can just restore it with no problem. So basically, your services are a whole lot more portable. I recently did this when dedipath went under. Pulled my latest backup to a new server at virmach, and I was up and running as soon as the DNS propagated.

[–] theterrasque@infosec.pub 5 points 11 months ago* (last edited 11 months ago) (1 children)

Modularity, compartmentalization, reliability, predictability.

One software needs MySQL 5, another needs mariadb 7. A third service needs PHP 7 while the distro supported version is 8. A fourth service uses cuda 11.7 - not 11.8 which is what everything in your package manager uses. a fifth service's install was only tested on latest Ubuntu, and now you need to figure out what rpm gives the exact library it expects. A sixth service expects odbc to be set up in a very specific way, but handwaves it in the installation docs. A seventh program expects a symlink at a specific place that is on the desktop version of the distro, but not the server version. And then you got that weird program that insist on admin access to the database so it can create it's own user. Since I don't trust it with that, let it just have it's own database server running in docker and good riddance.

And so on and so forth.. with docker not only is all this specified in excruciating details, it's also the exact same setup on every install.

You don't have it not working on arch because the maintainer of a library there decided to inline a patch that supposedly doesn't change anything, but somehow causes the program to segfault.

I can develop a service on windows, test it, deploy it to my Kubernetes cluster, and I don't even have to worry about which machine to deploy it on, it just runs it on a machine. Probably an Ubuntu machine, but maybe on that Gentoo node instead. And if my osx friend wants to try it out, then no problem. I can just give him a command, and it's running on his laptop. No worries about the right runtime or setting up environment or libraries and all that.

If you're an old Linux admin... This is what utopia looks like.

Edit: And restarting a container is almost like reinstalling the OS and the program. Since the image is static, restarting the container removes all file system cruft too and starts up a pristine new copy (of course except the specific files and folders you have chosen to save between restarts)

[–] themurphy@lemmy.world 2 points 11 months ago (1 children)

It sounds very nice and clean to work with!

If I'm lucky enough to get the Raspberry 5 at Christmas, I will try to set it up with docker for all my services!

Thanks for the explanation.

[–] theterrasque@infosec.pub 1 points 11 months ago

Just remember that Raspberry is an ARM cpu, which is a different architecture. Docker can cross compile to it, and make multiple images automatically. It takes more time and space though, as it runs an arm emulator to make them.

https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ has some info about it.