Thank you LSIO and what I have learnt

Posted on
tech docker

It is time to give back even more than I do but not beating the masters that I have learnt from.

I have been hanging in the Linuxserver (LSIO) Discord channel (https://discord.gg/UmjpTy) for some time now, there I have been pestering the super nice people with the same questions over and over, yesterday one of them told me to write a blog post about what I have learnt, both for give back but also a place to go to when I need the same answer once again.

So what will this be about? Docker and to more precice docker-compose, first of how to install all of them correctly on Linux.

Here’s my first opinion, Docker should run on Linux, every other OS virtualize a Linux container to be able to run docker.

Docker is dependent on two kernal modules that are present in the Linux kernal.

I will require you to know your basic Linux.

https://linuxize.com/post/how-to-install-and-use-docker-on-debian-10/

So docker-compose, first check what the latest version is at: https://github.com/docker/compose/releases

Then install it:

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-10

Great, lets continue.

What are the quesstions that I always ask?

  1. How do I add an subdomain to LSIO’s Letsencrypt container
  2. How do I call an container via it’s published port?

First off them I have to become a bit long, but wait, I can tell you to do what I did more than once… I read this guide and what ever you think this comtains your problem not descibed as a problem but as a feature that you might want to add to your setup.

https://blog.linuxserver.io/2019/04/25/letsencrypt-nginx-starter-guide/

It is a really good post about how to setup their most excellent Letsencrypt container.

I can reallt recommend using Cloudflare to handle your domains, it is free and works just awesome with this setup. Wildcard subdomains anyone?

Well a good command for this setup is:

docker logs letsencrypt

You know your done when the last line says “Server ready”, dont mid the errors above nothing that is a problem for you or me.

In that ouput it also tell you what you have done wrong, by missing data or raw errors, mind them and correct them.

Well that was question 1, and that wasn’t that long right?

So qustion 2 then.

This is my most recent issue that I got help with.

I have a docker-compose with 5 different containers that all need to talk to each other.

First I saw to that they have unique published ports and while I checked that I uses a series of port numbers so I easily remeber the ports. Logic right? Yeah but…

There is one reason to run docker-compose that shines more than any other, and that is when you start an compose it cretes a network for all containers with the service names as dns-names.

That is why I use compose.

That is also what I threw out the window when I setup this docker-compose.

Inside the services I specified service 1 to talk to service 2 using host ip with port-number.

It works until you decide to move the install to another server, new IP…. oh shite.

Time to change, wasnt docker super easy to move, you think.

Hold on - what id I just tell you?

Yeah docker-compose creates and dns-network for the containers, so why go over the stream for water?

So first of, change the published ports back to the default ones, this is where using Linuxserver containers, there is more than what the eyes sees in play here.

Now add the service dns-name inside the services that needs to talk to the others.

Suddenly you have a platform agnostic compose file. Pretty nice - right?

When all this was done with my solution I can move this compose where ever I want with no work at all when starting in on a new machine.