Skip to content

"OTEL_RESOURCE_ATTRIBUTES" in .env is ignored when using docker compose #4958

Description

@mrasu

Description

When using docker compose, value of "OTEL_RESOURCE_ATTRIBUTES" specifyied at .env file is ignored and the value becomes docker.cli.cobra.command_path=docker%20compose instead.
It seems #4875 changes behahavior to override OTEL_RESOURCE_ATTRIBUTES.

use-case

opentelemetry-demo uses .env to specify service.namespace for otel's namespace.
But it is not working now.

You can see code here

Reproduce

  1. Create .env file specifing OTEL_RESOURCE_ATTRIBUTES
OTEL_RESOURCE_ATTRIBUTES="service.namespace=opentelemetry-demo"
  1. Create docker-compose.yml using OTEL_RESOURCE_ATTRIBUTES
services:
  something:
    image: ubuntu
    command: tail -f /dev/null
    environment:
      - OTEL_RESOURCE_ATTRIBUTES
  1. docker compose up
  2. Go into "something"
  3. Check ${OTEL_RESOURCE_ATTRIBUTES}
  4. You will see the value is docker.cli.cobra.command_path=docker%20compose instead of service.namespace=opentelemetry-demo

Expected behavior

Keep the value of "OTEL_RESOURCE_ATTRIBUTES" in .env.
I believe adding docker.cli.cobra.command_path attribute is fine but the original value should be kept

docker version

Client: Docker Engine - Community
 Cloud integration: v1.0.24
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:17:48 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:17:48 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    26.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.13.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.5.0
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /usr/lib/docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.17.0
    Path:     /usr/lib/docker/cli-plugins/docker-scan

Server:
 Containers: 199
  Running: 1
  Paused: 0
  Stopped: 198
 Images: 2751
 Server Version: 26.0.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.5.0-26-generic
 Operating System: Ubuntu 22.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 46.34GiB
 Name: hiroaki
 ID: UHYB:2Z3Y:2UOI:65QQ:5RSA:GUY5:IIIY:CLDG:M5ED:EW2D:43T2:6VNF
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions