"unsupported opentelemetry exporter None" with "docker-compose up"
Description
Today I and some of my colleagues started experiencing this error:
% docker-compose up
[+] Building 0.0s (0/0) docker:desktop-linux
unsupported opentelemetry exporter None
Steps To Reproduce
Working on the sources I was able to reproduce it with the following minimized example:
FROM busybox
RUN touch my.txt
services:
test:
build:
context: .
% docker-compose --debug up
DEBU[0000] Enabled Docker Desktop integration (experimental) @ unix:///Users/me/Library/Containers/com.docker.docker/Data/docker-cli.sock
DEBU[0000] using default config store "/Users/me/.docker/buildx"
[+] Building 0.0s (0/0) docker:desktop-linux
DEBU[0000] using default config store "/Users/me/.docker/buildx"
DEBU[0000] otel error error="<nil>"
DEBU[0000] otel error error="<nil>"
unsupported opentelemetry exporter None
Compose Version
Docker Compose version v2.27.0-desktop.2
Docker Compose version v2.27.0-desktop.2
Docker Environment
Client:
Version: 26.1.1
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0-desktop.1
Path: /Users/me/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.0-desktop.2
Path: /Users/me/.docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.29
Path: /Users/me/.docker/cli-plugins/docker-debug
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: /Users/me/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.23
Path: /Users/me/.docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: /Users/me/.docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.1.0
Path: /Users/me/.docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/me/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.8.0
Path: /Users/me/.docker/cli-plugins/docker-scout
Server:
Containers: 12
Running: 0
Paused: 0
Stopped: 12
Images: 91
Server Version: 26.1.1
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: cgroupfs
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: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.6.26-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 7.656GiB
Name: docker-desktop
ID: f24fc6e4-f6bf-4f82-bc78-117bbc7dc65e
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///Users/me/Library/Containers/com.docker.docker/Data/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
Anything else?
If I change docker-compose.yaml to
services:
test:
image: busybox
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:
% docker-compose --debug up
DEBU[0000] Enabled Docker Desktop integration (experimental) @ unix:///Users/me/Library/Containers/com.docker.docker/Data/docker-cli.sock
[+] Running 1/0
✔ Container analytics_service-test-1 Created 0.0s
Attaching to test-1
DEBU[0005] otel error error="<nil>"
test-1 exited with code 0
DEBU[0010] otel error error="<nil>"
DEBU[0010] otel error error="<nil>"
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.
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
.envfile 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.envfile 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 is 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.