Building My First Container
An Invaluable Tool
I've been using Docker containers for several years to self-host services. They allowed me to scale up my network and services to multiple machines and networks while still remaining easily manageable. Once I got a solid grasp on containers, I started to wonder why people even use VMs (Virtual Machines) anymore (other than technical debt). However, until about a week ago, I had never actually built a container image myself.
I started learning about containers from a 'consumer' perspective. I watched 'home lab' videos, read tutorials, and poked around the related subreddits. I got so excited about the possibilities and services I could run, that I found good repositories (like linuxserver.io) and just started deploying stuff.
Motivation
Everything went well for a couple years, but more often I've started running into some problems:
- Some images I use stopped being maintained. This is especially common with gaming-related containers, as most of these are made by fans of the game who stop maintaining when they get a new job or move on to something else. This often broke server-client compatibility as servers fell farther and father behind. This also means security vulnerabilities started piling up.
- Things I want to host don't have (official) containers. I could get around this by deploying some random dude's container with 12 downloads and no documentation, but that never sat well with me, especially since I didn't know enough about the inner workings of a container to properly audit them. Bare metal is sometimes an option, but managing bare-metal services scales out of control very quickly, which is why I use containers in the first place.
- Some containers are missing a few features I really want. Often times I find myself using a container wishing it used some environment variable or organized its file directories in a different way, but I was stuck using these images the way they were published.
Staring Me in the Face
The solution to all of these should seem obvious at this point. I needed to learn how to build my own containers. I had run some big scary scripts in the past that built them from cloned repositories before, but I had never written a Dockerfile on my own.
It was time to learn. I watched a quick tutorial (thanks TechnoTim), pulled up the Dockerfile documentation, and...
Where have you been all my life?
Granted, I've been using Linux for many years, and I'm very comfortable on the command line, but wow that was so much easier than I expected. I don't know what I was afraid of.
Fast-forward a week and I've already published my first Factorio Dedicated Server container, and it works great... no... better than that–it works exactly the way I want it to.
Building an Armada
This has inspired me to begin a longer project. For reasons I may get into in another post, I've always loved hosting game servers. However, there's not a lot of standardization in configuring and deploying them. I believe I can build a solution to that.
I have several ideas on what that might look like, but I'll go over that in a future post. Until then, check out jelliefrontier.net/games for a list of the containers I'm currently building and maintaining.