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

# Docker

### Spin up Keep with docker-compose latest images

The easiest way to start keep is is with docker-compose:

```shell theme={null}
curl https://raw.githubusercontent.com/keephq/keep/main/start.sh | sh
```

```bash start.sh theme={null}
#!/bin/bash
# Keep install script for docker compose
set -e

echo "Creating state directory."
mkdir -p state
test -e state || echo "Unable to create folder"
echo "Changing directory ownership to non-privileged user."
chown -R 999:999 state || echo "Unable to change directory ownership, changing permissions instead." && chmod -R 0777 state
which curl &> /dev/null || echo "curl not installed"
curl https://raw.githubusercontent.com/keephq/keep/main/docker-compose.yml --output docker-compose.yml
curl https://raw.githubusercontent.com/keephq/keep/main/docker-compose.common.yml --output docker-compose.common.yml

docker compose up -d
```

The docker-compose.yml contains 3 services:

* [keep-backend](https://console.cloud.google.com/artifacts/docker/keephq/us-central1/keep/keep-api?project=keephq) - a fastapi service that as the API server.
* [keep-frontend](https://console.cloud.google.com/artifacts/docker/keephq/us-central1/keep/keep-ui?project=keephq) - a nextjs app that serves as Keep UI interface.
* [keep-websocket-server](https://docs.soketi.app/getting-started/installation/docker) - Soketi (a pusher compatible websocket server) for real time alerting.

### Debugging Keep UI

The debug UI image uses the same production server as the regular image, with
browser source maps and console output retained. The `Release Debug UI Image`
workflow publishes `ghcr.io/keephq/keep-frontend:<version>-dev` when the release
version changes on `main`. It can also be run manually with a release tag or
commit containing debug-image support.

To debug an existing deployment, replace only the frontend image with the
matching `<version>-dev` image. Keep its environment variables, ports, and
oauth2-proxy configuration, then reproduce the error with browser developer
tools open and JavaScript source maps enabled. This also works in Kubernetes
without running a local development server.

You can build the image yourself from the corresponding release checkout:

```sh theme={null}
docker build -f docker/Dockerfile.ui \
  --build-arg KEEP_INCLUDE_SOURCES=true \
  -t keep-ui:debug keep-ui
```

`KEEP_INCLUDE_SOURCES` is a **build argument**. Setting it only in a running
container cannot generate source maps or change the routes compiled by Next.js.
Source maps are included even when Sentry is disabled at build time. Debug images
serve frontend source code to browsers; switch back to the regular image after
debugging. Regular builds continue to block requests for source maps.

### Reinstall Keep with the option to refresh from scratch

`Caution:` This usage context will refresh from the beginning and Keep's data and settings will be erased. Even other containers on this host are also erased. So please consider when using the steps below.

For cases where you need to test many different options or simply want to reinstall Keep from scratch using docker compose without spending a lot of time, that is, without repeating the steps of installing docker, downloading the installer.. .. run the commands according to the previous instructions.

Follow these steps

#### Step1: Stop, Clear container, network, volume, image.

In the directory containing the docker compose file you downloaded, say `/root/`

```
docker-compose down

docker-compose down --rmi all

docker-compose down -v

docker system prune -a --volumes
```

#### Step2: Clear Config db, config file in state folder.

```
rm -rf state/*

```

#### Step 3: Run again

```
docker compose up -d
```


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