Skip to content

Instantly share code, notes, and snippets.

@jasonnerothin
Last active November 4, 2025 18:33
Show Gist options
  • Select an option

  • Save jasonnerothin/d3ac064baa25049da1925e5cfa8243f3 to your computer and use it in GitHub Desktop.

Select an option

Save jasonnerothin/d3ac064baa25049da1925e5cfa8243f3 to your computer and use it in GitHub Desktop.
Elasticstack Docker Compose config for Edot Collector with docker_stats daemon
configs:
# This is the minimal yaml configuration needed to listen on all interfaces
# for OTLP logs, metrics and traces, exporting to Elasticsearch.
edot-collector-config:
content: |
receivers:
# Receives data from other Collectors in Agent mode
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317 # Listen on all interfaces
http:
endpoint: 0.0.0.0:4318 # Listen on all interfaces
# Docker Stats receiver for container metrics
docker_stats:
endpoint: unix:///var/run/docker.sock
collection_interval: 10s
timeout: 20s
connectors:
elasticapm: {} # Elastic APM Connector
processors:
batch:
send_batch_size: 1000
timeout: 1s
send_batch_max_size: 1500
batch/metrics:
send_batch_max_size: 0 # Explicitly set to 0 to avoid splitting metrics requests
timeout: 1s
elastictrace: {} # Elastic Trace Processor
exporters:
debug: {}
elasticsearch/otel:
endpoints:
- http://elasticsearch:9200
user: elastic
password: ${ES_LOCAL_PASSWORD}
tls:
insecure_skip_verify: true
mapping:
mode: otel
service:
pipelines:
metrics:
receivers: [otlp]
processors: [batch/metrics]
exporters: [debug, elasticsearch/otel]
metrics/docker:
receivers: [docker_stats]
processors: [batch/metrics]
exporters: [debug, elasticsearch/otel]
logs:
receivers: [otlp]
processors: [batch]
exporters: [debug, elasticapm, elasticsearch/otel]
traces:
receivers: [otlp]
processors: [batch, elastictrace]
exporters: [debug, elasticapm, elasticsearch/otel]
metrics/aggregated-otel-metrics:
receivers:
- elasticapm
processors: [] # No processors defined in the original for this pipeline
exporters:
- debug
- elasticsearch/otel
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_LOCAL_VERSION}
container_name: ${ES_LOCAL_CONTAINER_NAME}
volumes:
- dev-elasticsearch:/usr/share/elasticsearch/data
ports:
- 127.0.0.1:${ES_LOCAL_PORT}:9200
environment:
- discovery.type=single-node
- ELASTIC_PASSWORD=${ES_LOCAL_PASSWORD}
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=false
- xpack.license.self_generated.type=trial
- xpack.ml.use_auto_machine_memory_percent=true
- ES_JAVA_OPTS=${ES_LOCAL_JAVA_OPTS}
- cluster.routing.allocation.disk.watermark.low=${ES_LOCAL_DISK_SPACE_REQUIRED}
- cluster.routing.allocation.disk.watermark.high=${ES_LOCAL_DISK_SPACE_REQUIRED}
- cluster.routing.allocation.disk.watermark.flood_stage=${ES_LOCAL_DISK_SPACE_REQUIRED}
- "_JAVA_OPTIONS=-XX:UseSVE=0"
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test:
[
"CMD-SHELL",
"curl --output /dev/null --silent --head --fail -u elastic:${ES_LOCAL_PASSWORD} http://elasticsearch:9200",
]
interval: 10s
timeout: 10s
retries: 30
kibana_settings:
depends_on:
elasticsearch:
condition: service_healthy
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_LOCAL_VERSION}
container_name: ${KIBANA_LOCAL_SETTINGS_CONTAINER_NAME}
restart: 'no'
command: >
bash -c '
echo "Setup the kibana_system password";
start_time=$$(date +%s);
timeout=60;
until curl -s -u "elastic:${ES_LOCAL_PASSWORD}" -X POST http://elasticsearch:9200/_security/user/kibana_system/_password -d "{\"password\":\"${KIBANA_LOCAL_PASSWORD}\"}" -H "Content-Type: application/json" | grep -q "^{}"; do
if [ $$(($$(date +%s) - $$start_time)) -ge $$timeout ]; then
echo "Error: Elasticsearch timeout";
exit 1;
fi;
sleep 2;
done;
'
kibana:
depends_on:
kibana_settings:
condition: service_completed_successfully
image: docker.elastic.co/kibana/kibana:${ES_LOCAL_VERSION}
container_name: ${KIBANA_LOCAL_CONTAINER_NAME}
volumes:
- dev-kibana:/usr/share/kibana/data
- ./config/telemetry.yml:/usr/share/kibana/config/telemetry.yml
ports:
- 127.0.0.1:${KIBANA_LOCAL_PORT}:5601
environment:
- SERVER_NAME=kibana
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=${KIBANA_LOCAL_PASSWORD}
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=${KIBANA_ENCRYPTION_KEY}
- ELASTICSEARCH_PUBLICBASEURL=http://localhost:${ES_LOCAL_PORT}
- MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED=true
- XPACK_SPACES_DEFAULTSOLUTION=oblt
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://kibana:5601 | grep -q 'HTTP/1.1 302 Found'",
]
interval: 10s
timeout: 10s
retries: 30
edot-collector:
image: docker.elastic.co/elastic-agent/elastic-otel-collector:${ES_LOCAL_VERSION}
container_name: ${EDOT_LOCAL_CONTAINER_NAME}
depends_on:
elasticsearch:
condition: service_healthy
command: [
"--config=/etc/otelcol-contrib/config.yaml",
]
configs:
- source: edot-collector-config
target: /etc/otelcol-contrib/config.yaml
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "4317:4317" # grpc
- "4318:4318" # http
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo -n > /dev/tcp/127.0.0.1/4317'"]
retries: 300
interval: 1s
volumes:
dev-elasticsearch:
dev-kibana:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment