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

# Run Docker in sessions

> Turn on the Docker setting so Cake Agents starts a rootless Docker daemon in each session pod and agents can build and run containers.

When you turn on **Enable Docker**, Cake Agents runs a rootless Docker daemon alongside each new session. Agents can then use the `docker` CLI, including `docker buildx` and `docker compose`, to build images and run containers as part of their work.

The setting is off by default, applies to the whole organization, and is currently in beta.

## When to use Docker in sessions

* Your repositories build container images or run tests with Docker Compose.
* Agents need to start services, such as databases, in containers to verify their changes.

Leave the setting off if your sessions don't need containers. Each Docker-enabled session pod runs an extra container and uses more cluster resources.

## Prerequisites

* You are signed in as an administrator.
* On self-hosted Kubernetes, your cluster allows privileged containers in the namespace where session pods run. The Docker daemon runs in rootless mode, but its sidecar container still sets `privileged: true` in its security context. Pod Security Admission policies or admission controllers that reject privileged pods block Docker-enabled sessions from starting.

## Turn on Docker

1. Sign in to Cake Agents as an administrator.
2. Open `Settings → Organization → Sessions`.
3. In the **Docker** section, toggle **Enable Docker** on.

The setting saves as soon as you select the toggle. It applies to sessions created after you turn it on. Existing sessions are unaffected until they restart.

To stop running Docker in new sessions, toggle **Enable Docker** off.

## How Docker runs in a session

* Cake Agents adds a container named `docker` to each session pod. It runs a rootless Docker daemon (`docker:29.10.0-dind-rootless`) and requests 100m CPU and 256Mi memory.
* The daemon listens only on a Unix socket shared with the session container. It does not expose a TCP API on the pod network.
* Cake Agents sets `DOCKER_HOST` to `unix:///var/lib/cake/docker/docker.sock` in the session, so `docker` commands reach the daemon without extra configuration.

To confirm Docker works, ask the agent to run:

```bash theme={null}
docker info
```

When the setting is off, sessions have no Docker daemon and `DOCKER_HOST` is not set, so `docker` commands fail to connect.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.