Open greatvovan opened 4 months ago
Please check you have OTEL_TRACES_EXPORTER
variable set. none
value is supported but should be lowercase
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?
This is not the default value, this None
(uppercase) is probably set in your environment.
Can you please try running docker buildx build .
to build your Dockerfile and confirm you get a distinct behavior ?
Yes, your command succeeds in the same shell where docker-compose
fails.
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 ?
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?
Documentation is highly confusing regarding .env file, a rewrite is on its way (https://github.com/docker/docs/pull/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)
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.
Description
Today I and some of my colleagues started experiencing this error:
Steps To Reproduce
Working on the sources I was able to reproduce it with the following minimized example:
Compose Version
Docker Environment
Anything else?
If I change docker-compose.yaml to
the
up
command succeeds. It looks like it happens only if build is involved.If I add some long-running command (e.g.
sleep 10
), the otel-related messages keep appearing though container runs:The error is happening on my MacOS 14.4.1 (23E224), and my colleagues who reporting the same use Mac ~as well as Windows machines~. it looks like it appeared only today, they report it worked just yesterday. EDIT: nope, it was another error on Windows machines.