Skip to content

Add locust-otel Docker image with OpenTelemetry dependencies#3379

Merged
cyberw merged 4 commits intolocustio:masterfrom
eyupcanakman:feat/docker-otel-libs-3309
Mar 22, 2026
Merged

Add locust-otel Docker image with OpenTelemetry dependencies#3379
cyberw merged 4 commits intolocustio:masterfrom
eyupcanakman:feat/docker-otel-libs-3309

Conversation

@eyupcanakman
Copy link
Copy Markdown
Contributor

The official Docker image does not include the OpenTelemetry exporter libraries, so running with --otel fails with an import error.

Added a Dockerfile.otel that installs the [otel] extras and publishes a separate locustio/locust-otel image. A CI test job verifies the OTel packages import correctly before publish.

Fixes #3309

Add Dockerfile.otel based on Dockerfile.ci that installs locust[otel]
extras. Add CI jobs to test and publish the image to the
locustio/locust-otel Docker Hub repository.

Fixes locustio#3309
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove otel here

@cyberw
Copy link
Copy Markdown
Collaborator

cyberw commented Mar 21, 2026

Niiice! Would it be possible to chain the build to reduce duplication? So the other file becomes just something like this (not tested)

FROM locustio/locust
RUN pip install "$(echo dist/*.whl)[otel]"

Reduce duplication by building Dockerfile.otel on top of the base
locust image instead of repeating all build steps from Dockerfile.ci.

The OTEL image now uses a build arg (BASE_IMAGE) so CI can point it
at the locally built or just-published base image. The publish job
depends on publish-docker to guarantee the base image exists.
The Buildx builder runs inside an isolated BuildKit container that
cannot see images loaded into the host Docker daemon via load: true.
Use plain docker build for the OTel image so it can resolve the
locally-built base image directly.
The dedicated locustio/locust-otel image covers this now.
@eyupcanakman
Copy link
Copy Markdown
Contributor Author

@cyberw The Dockerfile already chains from the base image. It does FROM ${BASE_IMAGE} and installs the wheel with [otel] extras on top. The COPY ./dist is needed because the wheel isn't on PyPI at build time.

Fixed the CI failure and removed the otel line from the base image example. The otel build was using Buildx, which runs in an isolated BuildKit container that can't see images loaded into the host Docker daemon via load: true. Switched to plain docker build for that step.

@cyberw cyberw merged commit 3cc8d7d into locustio:master Mar 22, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker image does not have OTEL libraries installed

2 participants