This post is for that one other person who’s losing their mind over a bizarre issue: lowercase environment variables with dots in their names not showing up in one environment, when it works elsewhere.
The client’s request was simple: configure all environment variables with a naming convention like my.app.variable
. Everything I knew suggested this was impossible—environment variables typically follow a UPPERCASE_SNAKE_CASE convention and don’t play well with special characters like dots. Yet, in their environment it works.
The Investigation
To get to the bottom of this, I created a minimal, reproducible example using a simple Java application that reads an environment with the k8s and dockerfile need to run it. I hosted the code on GitHub for anyone to see and confirm: it worked. I could evensh
into the container and confirm the variables were present and correctly formatted using the env
command.
The puzzle deepened. The environment variables were definitely there and readable, so why couldn’t my real application see them?
The Unexpected Culprit
After a lot of debugging, I finally found the problem: the Docker base image.
In the client’s working environment and my local test (by coincidence), were running on eclipse-temurin:21-jre-alpine
. The actual project code, however, was using eclipse-temurin:21-jre
.
The difference seems subtle, but it was critical. The alpine version, being a minimal Linux distribution, likely handles environment variable parsing differently or has a different shell configuration (via the entry point being bash) that allows these non-standard variable names to be passed and read correctly. The standard image, based on a different underlying OS (likely Debian or similar), does not.