GithubHelp home page GithubHelp logo

Comments (9)

ndeloof avatar ndeloof commented on July 28, 2024 1

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.

ndeloof avatar ndeloof commented on July 28, 2024

Please check you have OTEL_TRACES_EXPORTER variable set. none value is supported but should be lowercase

from compose.

greatvovan avatar greatvovan commented on July 28, 2024

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.

ndeloof avatar ndeloof commented on July 28, 2024

This is not the default value, this None (uppercase) is probably set in your environment.

from compose.

ndeloof avatar ndeloof commented on July 28, 2024

Can you please try running docker buildx build . to build your Dockerfile and confirm you get a distinct behavior ?

from compose.

greatvovan avatar greatvovan commented on July 28, 2024

Yes, your command succeeds in the same shell where docker-compose fails.

from compose.

ndeloof avatar ndeloof commented on July 28, 2024

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.

greatvovan avatar greatvovan commented on July 28, 2024

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.

greatvovan avatar greatvovan commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.