# Run streamview in Docker

Run the demo, Kafka, or NATS command of streamview in a container.

Source: https://www.eventcatalog.dev/tools/streamview/docs/how-to/run-in-docker

You need only Docker.
The image is `ghcr.io/event-catalog/streamview`. It contains the program, Node.js, and the three adapters.

## Run the demo

```
docker run --rm -p 127.0.0.1:4747:4747 ghcr.io/event-catalog/streamview
```

Then open `http://localhost:4747`. The container starts the demo by default.

## Read Kafka, NATS, or RabbitMQ

Put the streamview command after the image name:

```
docker run --rm -p 127.0.0.1:4747:4747 ghcr.io/event-catalog/streamview kafka --brokers broker:9092
```

The container must be able to connect to the broker.
In Docker Compose, use the service name of the broker as the host name.
The files `example/docker-compose.yml` and `example-nats/docker-compose.yml` show a full configuration.

## Keep the events when the container stops

Put the SQLite file on a volume, and give its path with `--db`.

```
docker run --rm -p 127.0.0.1:4747:4747 -v streamview-data:/data \
  ghcr.io/event-catalog/streamview kafka --brokers broker:9092 --db /data/streamview.db
```

## How the container is different

- The server in the container listens on `0.0.0.0`, because the image sets `STREAMVIEW_HOST`.
- The container does not open a browser.
- The `-p 127.0.0.1:4747:4747` argument keeps the page on your computer only. To let other computers connect, use `-p 4747:4747`.

## Related

- [Host a public demo](https://www.eventcatalog.dev/tools/streamview/docs/how-to/host-a-public-demo)
- [Build streamview from the source code](https://www.eventcatalog.dev/tools/streamview/docs/how-to/build-from-source)
- [Command line](https://www.eventcatalog.dev/tools/streamview/docs/reference/command-line)
