An Environment Variable Gotcha with Docker Entrypoints Dark _ □ ✕
  • Posts
  • About
  • Debug
Post

An Environment Variable Gotcha with Docker Entrypoints

Published
2026-08-02 00:00 UTC (precision: second)
Source feed
Emma Juettner's Blog excluded
Link
https://emmajuettner.com/posts/environment-variable-gotcha-docker-entrypoints/
Canonical
https://emmajuettner.com/posts/environment-variable-gotcha-docker-entrypoints
Length
2273 runes
Extracted text
I recently encountered an interesting quirk of handling environment variables while using Docker and wanted to record it here in case it proves useful again in the future, either to me or to someone else. Let's suppose I have a Java application which prints out the value of two environment variables, like so: public class MyApp { public static void main(String[] args) { String myDottedVariableValue = System.getenv("my.dotted.variable"); System.out.println("my.dotted.variable=" + myDottedVariableValue); String myUnderscoredVariableValue = System.getenv("my_underscored_variable"); System.out.println("my_underscored_variable=" + myUnderscoredVariableValue); } } Note that one of my variables has dots in it. This is pretty conventional for system properties in the Java/Spring ecosystem. So let's say I'm running this Java application in a Docker image. What will I see at runtime? Let's start by running our class in an Eclipse Temurin Docker base image with an exec form entrypoint: FROM eclipse-temurin:25 COPY MyApp.class . ENTRYPOINT ["java", "MyApp"] When I build and run the image with a value provided for both variables: docker build --tag 'my_image' -f Dockerfile . && docker run -e my.dotted.variable=dotted -e my_underscored_variable=underscored my_image:latest This is what I get: my.dotted.variable=dotted my_underscored_variable=underscored So both variable values are passed along for the Java application to use. Now let's change up the Dockerfile to use a shell form entrypoint instead: FROM eclipse-temurin:25 COPY MyApp.class . ENTRYPOINT java MyApp Now I'll execute the exact same command to build/run the Docker image again: docker build --tag 'my_image' -f Dockerfile . && docker run -e my.dotted.variable=dotted -e my_underscored_variable=underscored my_image:latest And here's the output I get at runtime: my.dotted.variable=null my_underscored_variable=underscored Suddenly my dotted variable is null! As it turns out, if you run your entrypoint through the shell, the shell may not pass along environment variables that are not named the way it expects. In a POSIX-compliant shell, environment variables are not supposed to have dots in them. And so our improperly named variable vanishes, while our other variable is passed along just fine.
Stored topics

Every stored assignment is listed, including rows below the current cutoff (0.75), so a missing tag can be explained.

Concept Code Score Meter Margin Origin Path
environment environment 0.91 2.35 direct environment
science and technology science-and-technology 0.89 2.13 direct science and technology
economy, business and finance economy-business-and-finance 0.68 0.75 ↑derived from local:software-development economy, business and finance
products and services products-and-services 0.68 0.75 ↑derived from local:software-development economy, business and finance > products and services
computing and information technology computing-and-information-technology 0.68 0.75 ↑derived from local:software-development economy, business and finance > products and services > computing and information technology
software and applications software-and-applications 0.68 0.75 ↑derived from local:software-development economy, business and finance > products and services > computing and information technology > software and applications
Software development software-development 0.68 0.75 direct economy, business and finance > products and services > computing and information technology > software and applications > Software development
Open source open-source 0.42 -0.34 direct economy, business and finance > products and services > computing and information technology > software and applications > Open source
technology and engineering technology-and-engineering 0.35 -0.62 ↑derived from local:information-security science and technology > technology and engineering
information technology and computer science information-technology-and-computer 0.35 -0.62 ↑derived from local:information-security science and technology > technology and engineering > information technology and computer science
Information security information-security 0.35 -0.62 direct science and technology > technology and engineering > information technology and computer science > Information security
artificial intelligence artificial-intelligence 0.30 -0.83 direct science and technology > technology and engineering > information technology and computer science > artificial intelligence
Self-hosting self-hosting 0.16 -1.68 direct economy, business and finance > products and services > computing and information technology > Self-hosting
scientific research scientific-research 0.04 -3.17 ↑derived from 20000739 science and technology > scientific research
scientific exploration scientific-exploration 0.04 -3.17 ↑derived from 20000739 science and technology > scientific research > scientific exploration
space exploration space-exploration 0.04 -3.17 direct science and technology > scientific research > scientific exploration > space exploration
media and entertainment industry media-and-entertainment-industry 0.03 -3.45 ↑derived from 20000306 economy, business and finance > products and services > media and entertainment industry
books and publishing books-and-publishing 0.03 -3.45 direct economy, business and finance > products and services > media and entertainment industry > books and publishing
film industry film-industry 0.03 -3.46 direct economy, business and finance > products and services > media and entertainment industry > film industry
Cryptography cryptography 0.02 -3.75 direct science and technology > technology and engineering > information technology and computer science > Cryptography
lifestyle and leisure lifestyle-and-leisure 0.02 -3.78 ↑derived from local:mmorpg lifestyle and leisure
leisure leisure 0.02 -3.78 ↑derived from local:mmorpg lifestyle and leisure > leisure
game game 0.02 -3.78 ↑derived from local:mmorpg lifestyle and leisure > leisure > game
video game video-game 0.02 -3.78 ↑derived from local:mmorpg lifestyle and leisure > leisure > game > video game
MMORPG mmorpg 0.02 -3.78 direct lifestyle and leisure > leisure > game > video game > MMORPG
natural science natural-science 0.02 -3.95 ↑derived from 20000719 science and technology > natural science
biology biology 0.02 -3.95 direct science and technology > natural science > biology
sport sport 0.02 -4.02 ↑derived from 20001183 sport
competition discipline competition-discipline 0.02 -4.02 ↑derived from 20001183 sport > competition discipline
eSports esports 0.02 -4.02 direct sport > competition discipline > eSports
streaming service streaming-service 0.02 -4.05 direct economy, business and finance > products and services > media and entertainment industry > streaming service
arts, culture, entertainment and media arts-culture-entertainment-and-media 0.01 -4.49 ↑derived from 20000003 arts, culture, entertainment and media
arts and entertainment arts-and-entertainment 0.01 -4.49 ↑derived from 20000003 arts, culture, entertainment and media > arts and entertainment
animation animation 0.01 -4.49 direct arts, culture, entertainment and media > arts and entertainment > animation
Tabletop gaming tabletop-gaming 0.01 -4.55 direct lifestyle and leisure > leisure > game > Tabletop gaming
politics and government politics-and-government 0.01 -4.55 direct politics and government
crime, law and justice crime-law-and-justice 0.01 -4.69 ↑derived from 20000086 crime, law and justice
crime crime 0.01 -4.69 ↑derived from 20000086 crime, law and justice > crime
cyber crime cyber-crime 0.01 -4.69 direct crime, law and justice > crime > cyber crime
labour labour 0.01 -4.84 direct labour
literature literature 0.01 -4.93 direct arts, culture, entertainment and media > arts and entertainment > literature
mass media mass-media 0.01 -4.97 ↑derived from local:blogging arts, culture, entertainment and media > mass media
social media social-media 0.01 -4.97 ↑derived from local:blogging arts, culture, entertainment and media > mass media > social media
Blogging blogging 0.01 -4.97 direct arts, culture, entertainment and media > mass media > social media > Blogging
visual arts visual-arts 0.01 -5.03 ↑derived from 20000036 arts, culture, entertainment and media > arts and entertainment > visual arts
photography photography 0.01 -5.03 direct arts, culture, entertainment and media > arts and entertainment > visual arts > photography
society society 0.01 -5.08 ↑derived from 20001300 society
fundamental rights fundamental-rights 0.01 -5.08 ↑derived from 20001300 society > fundamental rights
privacy privacy 0.01 -5.08 direct society > fundamental rights > privacy
conflict, war and peace conflict-war-and-peace 0.01 -5.19 direct conflict, war and peace
human interest human-interest 0.01 -5.20 ↑derived from 20000498 human interest
award and prize award-and-prize 0.01 -5.20 direct human interest > award and prize
health health 0.01 -5.20 direct health
exercise and fitness exercise-and-fitness 0.01 -5.21 direct lifestyle and leisure > wellness > exercise and fitness
wellness wellness 0.01 -5.21 ↑derived from 20001239 lifestyle and leisure > wellness
television television 0.01 -5.23 direct arts, culture, entertainment and media > mass media > television
weather weather 0.01 -5.25 ↑derived from 20001128 weather
weather forecast weather-forecast 0.01 -5.25 direct weather > weather forecast
education education 0.00 -5.37 direct education
card game card-game 0.00 -5.46 direct lifestyle and leisure > leisure > game > card game
health treatment and procedure health-treatment-and-procedure 0.00 -5.72 ↑derived from 20000465 health > health treatment and procedure
diet diet 0.00 -5.72 direct health > health treatment and procedure > diet
disease and condition disease-and-condition 0.00 -5.73 ↑derived from 20000458 health > disease and condition
mental health and disorder mental-health-and-disorder 0.00 -5.73 direct health > disease and condition > mental health and disorder
social sciences social-sciences 0.00 -5.80 ↑derived from 20000747 science and technology > social sciences
history history 0.00 -5.80 direct science and technology > social sciences > history
family family 0.00 -5.81 direct society > family
lifestyle lifestyle 0.00 -5.81 ↑derived from 20001257 lifestyle and leisure > lifestyle
house and home house-and-home 0.00 -5.81 ↑derived from 20001257 lifestyle and leisure > lifestyle > house and home
gardening gardening 0.00 -5.81 direct lifestyle and leisure > lifestyle > house and home > gardening
climate change climate-change 0.00 -5.83 direct environment > climate change
travel and tourism travel-and-tourism 0.00 -5.86 direct lifestyle and leisure > leisure > travel and tourism
disaster, accident and emergency incident disaster-accident-and-emergency-incident 0.00 -5.95 direct disaster, accident and emergency incident
religion religion 0.00 -5.96 direct religion
consumer goods consumer-goods 0.00 -6.23 ↑derived from 20001160 economy, business and finance > products and services > consumer goods
handicrafts handicrafts 0.00 -6.23 direct economy, business and finance > products and services > consumer goods > handicrafts
board game board-game 0.00 -6.30 direct lifestyle and leisure > leisure > game > board game
culture culture 0.00 -6.63 direct arts, culture, entertainment and media > culture
music music 0.00 -6.70 direct arts, culture, entertainment and media > arts and entertainment > music
hobby hobby 0.00 -6.77 ↑derived from 20000568 lifestyle and leisure > leisure > hobby
food and drink enthusiasm food-and-drink-enthusiasm 0.00 -6.77 direct lifestyle and leisure > leisure > hobby > food and drink enthusiasm
public health public-health 0.00 -6.81 direct health > public health
podcast podcast 0.00 -7.20 direct economy, business and finance > products and services > media and entertainment industry > podcast

← Back to posts

feedtagger 0.1.0-dev model: modernbert-base-zeroshot-v2.0/int8@all-s256 656 posts 0 unclassified min score 0.75