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

# Python SDK Docker containerization setup

export const plans_0 = "Any"

export const deployments_0 = "Any"

export const data_plane_version_0 = undefined

export const use_case_0 = undefined

<Note>
  **Applies to:**

  * Plan - {plans_0}
  * Deployment - {deployments_0}
  * {data_plane_version_0}
  * {use_case_0}
</Note>

## Summary

**Goal:** Containerize Python SDK scripts for automated logging and cronjobs using Docker.

**Features:** Python SDK, Docker containerization, environment variables for API key configuration.

## Configuration Steps

### Step 1: Create Dockerfile

Use a minimal Python base image and install the Braintrust SDK.

```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
FROM python:3.11-slim

WORKDIR /app

RUN pip install --no-cache-dir braintrust

COPY . .

ENV BRAINTRUST_API_KEY=""

CMD ["python", "your_script.py"]

```

### Step 2: Set API key at runtime

Pass your Braintrust API key as an environment variable when running the container.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
docker run -e BRAINTRUST_API_KEY=your_api_key your_image

```

### Step 3: Add dependencies

If your script requires additional packages, add a requirements.txt file.

```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .

```

## Notes

* Braintrust does not publish an official Docker image
* Python 3.10+ is required
* Use standard Docker best practices for production deployments
