Comments (9)
Documentation is highly confusing regarding .env file, a rewrite is on its way (docker/docs#19541)
.env
in your working directory is used to interpolate variables in your compose.yaml file, as described here but it is also used to configure Compose itself. This can be used to set COMPOSE_*
variables and typically change OTEL_METRICS_EXPORTER
. So the conflict here
The requirement for the containerized app is to have the value as "None" verbatim (not lowercase).
That's a bit weird as this is an non-standard value, but I assume you have no impact on this :) I guess your compose.yaml file has env_file: .env
set for container, one option is for you to use a distinct file name and a dedicated xx.env file for this container, or you can also override value in compose.yaml with environment: OTEL_METRICS_EXPORTER: None
(environment has precedence on env_file)
from compose.
Please check you have OTEL_TRACES_EXPORTER
variable set. none
value is supported but should be lowercase
from compose.
export OTEL_TRACES_EXPORTER=none
did not help, but OTEL_METRICS_EXPORTER=none
did.
I wonder, though, since when it is a requirement to have these variables set with docker-compose
? Is is documented somewhere? Why is unset variable not interpreted as none
by default?
from compose.
This is not the default value, this None
(uppercase) is probably set in your environment.
from compose.
Can you please try running docker buildx build .
to build your Dockerfile and confirm you get a distinct behavior ?
from compose.
Yes, your command succeeds in the same shell where docker-compose
fails.
from compose.
I can't tell what's wrong here. OTEL_METRICS_EXPORTER
is the standard variable used to configure opentelemetry (https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_metrics_exporter) and value is set by end user's environment, not compose. Have you checked you don't have value set in your .env
file ?
from compose.
Okay, I found that I do have .env
file and it has OTEL_METRICS_EXPORTER=None
, which is needed for the containerized app. The requirement for the containerized app is to have the value as "None" verbatim (not lowercase). What I don't understand is why it affects the docker-compose
utility itself, since as described in the documentation
An
.env
file in Docker Compose is a text file used to define environment variables that should be made available to Docker containers when running docker compose up. ... The.env
file is the default method for setting environment variables in your containers.
I read it as the .env
file is treated as a collection of environment variables that get propagated to the containers. In my user environment I have no OTEL_METRICS_EXPORTER variable set:
% echo .$OTEL_METRICS_EXPORTER.
..
Is it documented somewhere that the utility treats the .env
file as its own environment?
from compose.
Thank you for linking the docs, though I find that mixing of container and compose environment confusing...
That's a bit weird as this is an non-standard value
After looking into the implementation, none
will be accepted by the containerized software as well, but it is still good to change the setup to avoid this overlap.
from compose.
Related Issues (20)
- Official expected behavior about default ENV variables set in images and listed in docker-compose manifest HOT 6
- [BUG] defining more than one env_file parameter in docker compose will result in strange behaviour HOT 5
- [BUG] all=1 parameter is marked as invalid using Docker Compose with Podman HOT 2
- [BUG] 2.28.1 multiple COMPOSE_* vars no longer read from .env file
- [BUG] Completion doesn't work for files HOT 4
- [BUG] docker-compose cli fails due to missing distutils HOT 1
- compose-files include not support pattern HOT 6
- [BUG] Secret is unexpectedly empty at build time HOT 1
- [BUG] service refers to undefined network HOT 3
- [BUG] docker compose up service fails because of required network from another service HOT 1
- Warnings about unset environment variables even when not used in running containers HOT 4
- [BUG] !reset in override file doesn't work for depends_on HOT 2
- Add "--wait" to "docker compose run" HOT 2
- [BUG] <.env variable network name not working> HOT 7
- [BUG] Compose Templates when using Yaml Anchors aren't merging properly when service stack has additional values HOT 3
- Configure essential services - kill all services when essential services exit
- [BUG] Secret not being read from Environment HOT 3
- [BUG] Compose interpolates double dollar sign inside included file HOT 3
- [BUG] Cannot pause container - OCI runtime pause failed: unable to freeze: unknown" error_type="*errors.errorString" module=api HOT 2
- [BUG] `exec` command hijacks containers created with `run` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose.