this post was submitted on 23 Oct 2023
46 points (94.2% liked)

Selfhosted

40211 readers
1423 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've recently started a crusade for the perfect selfhosted note taking app.

I posted here and I read a lot of others posts and for now I think I have what I need.

But as I see Joplin recommended every now and then, and given it doesn't offer a webui I can access everywhere from any computer (you need to install their app), I had this thought: how could I dockerize, say, the Linux Joplin app so I can put it behind a reverse proxy with auth and access it when I'm away from home from any computer.

I've seen this done for soulseek, mkvtoolnix and others, so I know it is feasibile.

Being just a hobbyist selfhoster with no programming background, I'm not sure where to start educating myself.

I'm sure there are some guides out there, but I'm not sure what to look for, what terms to use in my searches.

Somebody could point me to the right direction?

top 18 comments
sorted by: hot top controversial new old
[–] dandroid@dandroid.app 24 points 1 year ago (1 children)

I learned by reading other Dockerfiles. They're very simple in theory. You start from a base image using the "FROM" command. You copy all your code files using the "COPY" command. Run any environment set up with the "RUN" command. Then execute your program with the "ENTRYPOINT" command. For very basic services, that's enough.

There are definitely some quirks that really you'll only learn by trying it yourself and making mistakes. But I say just do it. If you know all about Linux systems like with file permissions and such, it won't be too bad.

[–] Tiritibambix@lemmy.ml 5 points 1 year ago

Thanks for demystifying the basics for me :)

[–] kohana@kuu.kohana.fi 7 points 1 year ago (1 children)

There's a great free MOOC course by the University of Helsinki which I heavily recommend: https://devopswithdocker.com/

There's also a Kubernets continuation: https://devopswithkubernetes.com/

[–] Tiritibambix@lemmy.ml 2 points 1 year ago

Great. Thank you :)

[–] cecilkorik@lemmy.ca 7 points 1 year ago* (last edited 1 year ago) (1 children)

A Dockerfile is basically just a script that starts a container image (ranging from standard Linux OS installs like ubuntu or debian or alpine to the very specialized pre-made containers with every piece of software you want already installed and configured and everything unnecessary stripped away) and then does various stuff to it (copies files/dirs from local, runs commands, configures networking). It's all very straightforward, and if you know how to write a bash script or even just a basic batch file that's pretty much all its doing, and the end result is a container, which is basically a miniature Linux virtual machine (that is supposed to be "single purpose" but there's no technical limitation forcing it to be)

The simplest way to create a container is to use a standard OS container as I mentioned and install the software you want exactly as you normally would in that OS, using the OS package manager if you want, following tutorials for that OS or installing manually using the instructions from the software itself. Either way should work fine. Again, it's basically not much different from having a virtual machine running that OS. You can even start up a root bash prompt and install it that way if you prefer, or even connect over ssh by running an sshd server on it (although that's totally uneccessary and requires extra work).

For basic Dockerfile syntax, look at other people's Dockerfiles and realize you probably don't need 90% of the more complex ones. There are millions of them out there, you should be able to find some simple straightforward ones and just mimic those. Will you run into "gotchas"? Sure you will, Docker is full of them, and when you do your Dockerfile will get a little more complex as you find a way to deal with the problem Docker has created for you. Here's a pretty simple tutorial example of a Dockerfile that just installs a bunch of packages from Debian and doesn't even run any specific services, or alternatively here's a Dockerfile that does nothing but run and configure an ssh server like I mentioned above (again that's totally unnecessary normally but the point is you can certainly do it if you want to!)

[–] Tiritibambix@lemmy.ml 2 points 1 year ago

Wow, thank you for this very thorough explanation. Makes it a lot easier to apprehend and easier to start my research :)

[–] Research8165@kbin.social 4 points 1 year ago (2 children)

This video and its accompanying github repo got me started recently.

[–] Tiritibambix@lemmy.ml 2 points 1 year ago

Thank you for the ressource. I'll check it out

[–] PipedLinkBot@feddit.rocks 2 points 1 year ago

Here is an alternative Piped link(s):

video

Piped is a privacy-respecting open-source alternative frontend to YouTube.

I'm open-source; check me out at GitHub.

[–] Appoxo@lemmy.dbzer0.com 3 points 1 year ago (1 children)

Search an issue you have (say ads), research a tool that fits your purpose (pihole) and try to run it in docker.
If you don't understand something, research it.

At leasts that's how I did it.

[–] Tiritibambix@lemmy.ml 3 points 1 year ago (1 children)

I think my phrasing wasn't good, or maybe I misunderstand what you say (not a native English speaker), but I know how to run a container. I just want to run an existing app inside a container :)

[–] chunkystyles@sopuli.xyz 3 points 1 year ago (1 children)

Learning how to use other Docker images to run Docker containers is an important first step in that process.

I'm a programmer. My foray into learning how to containerize applications started by learning how to run containerized applications. Honestly, running them is the more complicated part (for many cases, some are dead simple).

Turning an app into an image is sometimes just a simple two line Dockerfile.

I started learning with Home Assistant and the branched out to pi hole, Frigate, Mosquito, and other home automation tools. I used that knowledge to containerize a home automation tool I wrote myself.

And now I'm working on containerizing dozens of applications at work.

[–] Tiritibambix@lemmy.ml 2 points 1 year ago

Thank you, I'll make good use of your advice :)

[–] plumbercraic@lemmy.sdf.org 3 points 1 year ago

I learned by using django cookie cutter and reading their compose, env, docker and start files. I guess there are easier ways than that though (YouTube, coursera, etc)

[–] StrawberryPigtails@lemmy.sdf.org 2 points 1 year ago (2 children)

I actually just ran across a video the other night that may help:

https://www.youtube.com/live/AHDrejEv0SM?si=7boS9kKG6aL8EQXN

It's part of a playlist about Kubernetes but this particular video is more about containers in general.

[–] Tiritibambix@lemmy.ml 2 points 1 year ago* (last edited 1 year ago)

Great, thank you for the link :)

[–] PipedLinkBot@feddit.rocks 1 points 1 year ago

Here is an alternative Piped link(s):

https://www.piped.video/live/AHDrejEv0SM?si=7boS9kKG6aL8EQXN

Piped is a privacy-respecting open-source alternative frontend to YouTube.

I'm open-source; check me out at GitHub.

[–] TechAdmin@lemmy.world 2 points 1 year ago* (last edited 1 year ago)

This project, https://neko.m1k1o.net/#/getting-started/examples , looks like a good base to try running regular GUI apps via docker & web.

edit: and here's the git with Dockerfiles, https://github.com/m1k1o/neko-apps