> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squasher.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker

> Collect errors and logs from Docker containers using OpenTelemetry Collector.

Collect logs from all your Docker containers and forward errors to Squasher using the OpenTelemetry Collector.

## Setup with Docker Compose

### 1. Add the OTel Collector

Add the collector to your `docker-compose.yml`:

```yaml theme={null}
# docker-compose.yml
services:
  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    volumes:
      - ./otel-config.yaml:/etc/otelcol-contrib/config.yaml
      - /var/lib/docker/containers:/var/lib/docker/containers:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - "4317:4317" # gRPC
      - "4318:4318" # HTTP
    restart: unless-stopped

  # Your existing services...
  web:
    image: your-app
    logging:
      driver: json-file # Default Docker logging driver
```

### 2. Configure the Collector

Create `otel-config.yaml`:

```yaml theme={null}
# otel-config.yaml
receivers:
  filelog/docker:
    include:
      - /var/lib/docker/containers/*/*.log
    operators:
      - type: json_parser
        timestamp:
          parse_from: attributes.time
          layout: "%Y-%m-%dT%H:%M:%S.%LZ"
      - type: move
        from: attributes.log
        to: body
      - type: move
        from: attributes.stream
        to: attributes["log.iostream"]

  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

exporters:
  otlphttp/squasher:
    endpoint: https://ingest.squasher.ai
    headers:
      x-squasher-key: "sq_pk_your_api_key"

processors:
  batch:
    timeout: 5s
    send_batch_size: 100

service:
  pipelines:
    logs:
      receivers: [filelog/docker, otlp]
      processors: [batch]
      exporters: [otlphttp/squasher]
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlphttp/squasher]
```

### 3. Start

```bash theme={null}
docker compose up -d
```

All container logs are now forwarded to Squasher. Error-level entries automatically create error groups with AI triage.

## Application Instrumentation

For richer error data (stack traces, user context), also instrument your applications with an OTel SDK. The collector receives spans from your apps on ports 4317/4318 and forwards them to Squasher alongside container logs.

See the language-specific guides:

* [Node.js / JavaScript](/integrations/opentelemetry)
* [Python](/integrations/python)
* [Go](/integrations/go)
* [Java](/integrations/java)
* [Ruby](/integrations/ruby)
* [.NET](/integrations/dotnet)

## Agent handoff

```text theme={null}
Configure Docker logs for Squasher project <project_id>. Add or update the OpenTelemetry Collector config, keep the x-squasher-key value in environment or secret storage, run the collector config validation if available, and verify with one container error log.
```
