Skip to content

Instantly share code, notes, and snippets.

@62mkv
Last active May 28, 2023 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 62mkv/4d6627cdace4ee512269cedac6e5bda2 to your computer and use it in GitHub Desktop.
Save 62mkv/4d6627cdace4ee512269cedac6e5bda2 to your computer and use it in GitHub Desktop.
How to run "Zipkin2 + Elasticsearch" with Docker Desktop on Windows 10 with WSL2 backend

Problem

Turns out, Zipkin, when run "simply" with something like docker run openzipkin/zipkin:latest, dies out of OOM very soon, under any meaningful load. To prevent this from happening, one would want to run it together with a storage backend, like Elasticsearch. Unfortunately, Zipkin docs are probably hopelessly outdated, at least, I could not achieve this based on their README alone.

Solution

Create this docker-compose.yaml:

version: "3.9"
services:

  zipkin-elasticsearch:
    image: ghcr.io/openzipkin/zipkin-elasticsearch7
    networks:
      - backend
    ports:
      - "9200:9200"

  zipkin: 
    image: openzipkin/zipkin:latest
    networks:
      - backend
    ports:
      - "9411:9411"
    environment:
      JAVA_OPTS: -XX:+ExitOnOutOfMemoryError
    links:
      - "zipkin-elasticsearch:storage"
    command: 
      - --zipkin.storage.type=elasticsearch
      - --zipkin.storage.elasticsearch.hosts=storage
    depends_on: 
      - zipkin-elasticsearch

networks:
  backend:

and then you can run it with docker compose up -d, as usual

Beware! In order for an Elasticsearch to get started successfully, a following hack needs to be applied on the "docker-desktop" VM: vm.max_map_count system property must be not less than 262144.

On Windows 10 with WSL2-backed Docker Desktop, you can do it as follows:

wsl -d docker-desktop (shell terminal opens)

sysctl -w vm.max_map_count=262144

This will set the value until next reboot. If you want to apply it statically, refer to here: https://stackoverflow.com/questions/69214301/using-docker-desktop-for-windows-how-can-sysctl-parameters-be-configured-to-per

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