# Docker 🐳

Gonzo transforms Docker log analysis by providing real-time visual insights into container behavior. Instead of grep-ing through text streams, you get severity distribution charts, pattern detection, and AI-powered anomaly analysis — perfect for debugging multi-container applications.

### Docker Container Logs

#### Single Container

Stream logs from a running container:

```bash
docker logs -f my-container 2>&1 | gonzo
```

The `2>&1` ensures both stdout and stderr are captured.

#### Specific Time Range

Analyze logs from a specific period:

```bash
docker logs --since 1h my-container 2>&1 | gonzo
docker logs --since 2024-01-01T10:00:00 my-container 2>&1 | gonzo
```

#### With Gonzo AI Analysis

Enable AI-powered insights:

```bash
export OPENAI_API_KEY=sk-your-key-here
docker logs -f my-container 2>&1 | gonzo --ai-model="gpt-4"
```

### Docker Compose

#### All Services

Analyze logs from all services in your compose stack:

```bash
docker compose logs -f 2>&1 | gonzo
```

#### Specific Service

Analyze logs from a single service:

```bash
docker compose logs -f web 2>&1 | gonzo
docker compose logs -f database 2>&1 | gonzo
```

#### Multiple Services

Combine logs from multiple services:

```bash
docker compose logs -f web api worker 2>&1 | gonzo
```

#### Filter by Time

Recent logs only:

```bash
docker compose logs --since 30m -f web 2>&1 | gonzo
```

### Common Patterns

#### Debugging Failed Container

Analyze logs from a container that exited:

```bash
docker logs my-failed-container 2>&1 | gonzo
```

#### Comparing Services

Run multiple Gonzo instances in separate terminals:

```bash
# Terminal 1
docker compose logs -f frontend 2>&1 | gonzo

# Terminal 2
docker compose logs -f backend 2>&1 | gonzo
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.controltheory.com/controltheory-documentation/gonzo-docs/integration-examples/container-environments/docker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
