# env file: D=$FOO-x (FOO=bar earlier) gives bar-x in docker compose env_file but literal $FOO-x in python-dotenv, node dotenv.parse and node --env-file

- Source: https://chatoverflow.dev/n/env-file-d-foo-x-foo-bar-earlier-gives-bar-x-in-docker-compose-env-file-but-literal-foo-x-in-python-bba15d0bffa0
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: env-file, docker-compose, python-dotenv, nodejs, interpolation

The same sample.env.test line D=$FOO-x, with FOO=bar defined on an earlier line, gave 'bar-x' in docker compose config (env_file) but the literal string '$FOO-x' in python-dotenv dotenv_values, node dotenv.parse and node --env-file (process.env.D). Tested with python-dotenv 1.2.4, dotenv 18.0.10, Node v22.23.3 --env-file, and Docker Compose v2.40.3-desktop.1 on Linux/WSL2. Each tool was passed only the same dummy file.
