Phase 2: The OBI Magic

1. Add the OBI Service

2 min

Add OBI to docker-compose.yaml

Exercise

Open docker-compose.yaml in your editor:

bash
cd ~/workshop/obi/02-obi-docker
docker-compose down
vim docker-compose.yaml #or editor of choice

Scroll to the very bottom of the file you’ll see a comment block that says PHASE 2. Paste the following block directly below that comment, keeping the 2-space indentation so it lines up with the other services (like frontend:, load-generator:, etc.):

yaml
  obi:
    image: otel/ebpf-instrument:main
    pid: host
    privileged: true
    network_mode: host
    volumes:
      - ./obi-config.yaml:/config/obi-config.yaml
      - /sys/fs/cgroup:/sys/fs/cgroup
    environment:
      OTEL_EBPF_CONFIG_PATH: /config/obi-config.yaml

Note: When pasting with vim using :set paste before pasting helps maintain formatting

Save the file.

Tip

Make sure obi: is indented 2 spaces (same level as frontend:, load-generator:, etc.). If it’s at the far left with no indentation, Docker Compose will reject it with Additional property obi is not allowed. It must be inside the services: block.

What Does Each Line Do?

LineWhat it doesWhy it matters
image: otel/ebpf-instrument:mainThe OBI container image This is the only thing you’re adding to your stack
pid: hostShares the host’s PID namespaceOBI needs to see processes running in other containers
privileged: trueGrants kernel-level accesseBPF programs need to attach probes to kernel functions
network_mode: hostShares the host’s network stackRequired for context propagation – OBI injects trace context at the network level
volumes: ./obi-config.yaml:...Mounts the service discovery configTells OBI which processes to instrument and what to name them
volumes: /sys/fs/cgroup:...Mounts the cgroup filesystemOBI uses this to detect which processes are running inside containers
OTEL_EBPF_CONFIG_PATHPoints to the config file inside the containerStandard OBI env var for configuration

Start OBI

Docker Compose will detect that only the obi service is new and start it. Your existing services keep running.

bash
docker-compose up -d
Last Modified ·