Today I learned that docker creates an empty /.dockerenv file to indicate that
you are running in a docker container. Other runtimes like podman commonly use
/run/.containerenv. kubernetes uses neither of these, the most common way to
detect if you are running in kubernetes is to check for the presence of the
KUBERNETES_SERVICE_HOST environment variable. There will also be a directory
at /var/run/secrets/kubernetes.io/serviceaccount that contains the service
account credentials if you are running in kubernetes.
Posts tagged: docker
All posts with the tag "docker"
I learned to today that setting MEMORY on your minecraft server causes the
JVM to egregiously allocate all of that memory. Not setting it causes slow
downs and potential crashes, but setting INIT_MEMORY and MAX_MEMORY gives
us the best of both worlds. It is allowed to use more, but does not gobble it
all up on startup.
In this economy we need to save all the memory we can!
Here is a non-working snippet for a minecraft server deployment in kubernetes.
containers:
- name: dungeon
image: itzg/minecraft-server
env:
- name: EULA
value: "true"
- name: INIT_MEMORY
value: "512M"
- name: MAX_MEMORY
value: "3G"
and in docker compose
dungeon:
image: itzg/minecraft-server
environment:
EULA: "true"
INIT_MEMORY: "512M"
MAX_MEMORY: "3G"
I recently noticed that my og images were missing emoji. They were taken using headless chrome in a container. I fixed it by adding an emoji font in the containerfile / dockerfile.
RUN apt-get update && apt-get install -y \
# Add fonts with emoji support
fonts-noto-color-emoji \
&& rm -rf /var/lib/apt/lists/*
Before #
Here’s what they were looking like with broken emoji fonts.
After #
And now with the fixed emoji font.
I put thought bubbles on my thoughts posts and stars on my github stars posts
Today I learned that the docs in postiz are a bit behind, (fantastic docs btw, they are to the point, and cover almost all of what you need). The docs state that you need to include an R2 bucket to handle uploads.
This issue shows that more work has been done, one of which is local storage. The compose file they use in the quick start has the required env variables to set this up.
STORAGE_PROVIDER: "local"
UPLOAD_DIRECTORY: "/uploads"
NEXT_PUBLIC_UPLOAD_DIRECTORY: "/uploads"
looking into my running instance I can see my images there.
⬢ [devtainer] ❯ podman exec postiz ls /uploads/2025/01/09
811747b3f703f5d9a7f10aff5103412ff0.jpeg
a221db10a76f0c414171ab417379b09ec.jpeg
In my adventure to put more homelab in docker, I moved our modded minecraft setup to docker.
Getting Mods #
So far I have found all of our mods from curse forge. modpacks make getting multiple mods working together much easier, someone else has already vetted a pack of often times 100+ mods that all play well together. I have yet to get these working in docker, I will, but for not I just have individual mods.
download file #
under the hood docker is using wget to get the mod. The link you click on from curseforge will block wget. What I do is pop open the devtools (f12 in chrome), click on the network tab, click the download link on the web page, and watch the real link show up.
Docker-compose #
I am using docker compose, it makes the command much easier to start, and all the things needed stored in a file. I am not using compose to run multiple things, just for the simple start command.
Create a directory for your server and add the following to a
docker-compose.yml file.
version: "3.8"
services:
mc:
container_name: walkercraft
image: itzg/minecraft-server
ports:
- 25565:25565
environment:
EULA: "TRUE"
TYPE: "FORGE"
VERSION: 1.16.5
MODS_FILE: /extras/mods.txt
REMOVE_OLD_MODS: "true"
tty: true
stdin_open: true
restart: unless-stopped
ports:
- 25565:25565
volumes:
- ./minecraft-data:/data
- ./mods.txt:/extras/mods.txt:ro
volumes:
data:
mods.txt #
Once you have your mod file link from the network tab add them to a mods.txt file next to your docker-compose file.
https://media.forgecdn.net/files/3620/189/engineersdecor-1.16.5-1.1.16.jar
start your server #
Once you have made it this far starting the server is pretty simple.
docker compose up -d
kill your server #
If your still in the same directory, taking down the server should be pretty easy as well.
docker compose down
# if that does not work you can kill it
docker ps
# copy the id of your container
docker kill <id>
I’ve ran a Minecraft server at home since December 2017 for me and my son to play on. We start a brand new one somewhere between every day and every week. The older he gets the longer the server lasts.
In all these years, I’ve been popping open the command line and running the server manually, and even inside of Digital Ocean occasionally to play a more public server with a friend.
My buddy Nic has been sharing me some of his homelab setup, and it’s really got me to thinking about what I can run at home, and Dockerizing all the things. Today I found a really sweet github repo that had a minecraft server running in docker with a pretty incredible setup.
I ended up running the first thing in the Readme that included a volume mount. If you are going to run this container, I HIGHLY reccomend that you make sure that you have your world volume mounted, otherwise it will die with your docker container.
Docker Compose #
With the following stored as my docker-compose.yml in a brand new and
otherwise empty directory I was ready to start the server for the night.
version: "3"
services:
mc:
container_name: walkercraft
image: itzg/minecraft-server
ports:
- 25565:25565
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: unless-stopped
volumes:
# attach a directory relative to the directory containing this compose file
- ./minecraft-data:/data
To start the server we open up the terminal in this directory and run the follwing command.
docker compose up -d
Once its up and running we can run commands on the server simply by attaching to it.
docker attach walkercraft
A few common commands we run in the server #
We play very casually most of the time so we will set keepInventory to true so that we do not loose our inventory when we die. Sometimes we also op ourselve so that we can toggle gamemode into creative.
# set the game to keep your inventory when you die.
/gamrule keepInventory true
# give everyone operater priveledges to they can run commands
/op @a
# give playername op
/op playername