# Lenses Box

{% embed url="<https://lenses.io/start/>" %}
Lenses Box download
{% endembed %}

## What’s in the Box? <a href="#whats-in-the-box" id="whats-in-the-box"></a>

Lenses Box contains all components of the Apache Kafka ecosystem, CLI tools, and synthetic data streams.

<figure><img src="/files/AHa219fd1FjZKOoswqHW" alt=""><figcaption><p>Lenses Box</p></figcaption></figure>

## Starting the Box <a href="#get-started" id="get-started"></a>

1. To start with the Box [get your free development license](https://lenses.io/apache-kafka-docker/) online.
2. Install and run the Docker

```bash
docker run --rm \
    -p 3030:3030 \
    --name=dev \
    --net=host \
    -e EULA="https://dl.lenses.stream/d/?id=CHECK_YOUR_EMAIL_FOR_KEY" \
    lensesio/box   
```

Open Lenses in your [browser](http://localhost:3030), log in with `admin/admin.`

## Kafka Docker advertisement <a href="#kafka-docker-a-dvertisement" id="kafka-docker-a-dvertisement"></a>

The broker in the Kafka docker has a broker id `101` and advertises the listener configuration endpoint to accept client connections.

If you run Docker on macOS or Windows, you may need to find the address of the VM running Docker and export it as the advertised listener address for the broker (On macOS it usually is `192.168.99.100`). At the same time, you should give the `lensesio/box` image access to the VM’s network:

```sh
docker run -e EULA="CHECK_YOUR_EMAIL_FOR_KEY" \
           -e ADV_HOST="192.168.99.100" \
           --net=host --name=dev \
           lensesio/box
```

If you run on Linux, you don’t have to set the `ADV_HOST` , but you can do something cool with it. If you set it to be your machine’s IP address, you can access Kafka from any clients in your network.

If you decide to run a box in the cloud, you (and all your team) can access Kafka from your development machines. Remember to provide the public IP of your server as the kafka advertised host for your producers and consumers to access it.

## Kafka Docker JMX <a href="#kafka-docker-jmx" id="kafka-docker-jmx"></a>

Kafka JMX metrics are enabled by default. Refer to ports once you expose the relevant port, ie. `-p 9581:9581` you can connect to JMX with

```bash
jconsole localhost:9581
```

## Custom hostname <a href="#custom-hostname" id="custom-hostname"></a>

If you are using docker-machine or setting this up in a Cloud or **DOCKER\_HOST** is a custom IP address such as `192.168.99.100`, you will need to use the parameters `--net=host -e ADV_HOST=192.168.99.100`.

```sh
docker run --rm \
    -p 3030:3030 \
    --net=host \
    -e ADV_HOST=192.168.99.100 \
    -e EULA="https://dl.lenses.stream/d/?id=CHECK_YOUR_EMAIL_FOR_KEY" \
    lensesio/box    
```

## Docker data persistence <a href="#docker-data-persistence" id="docker-data-persistence"></a>

To persist the Kafka data between multiple executions, provide a name for your Docker instance and do not set the container to be removed automatically (`--rm` flag). For example:

```sh
docker run \
    -p 3030:3030 -e EULA="CHECK_YOUR_EMAIL_FOR_KEY" \
    --name=dev lensesio/box
```

Once you want to free up resources, just press `Control-C`. Now you have two options: either remove the Docker:

```sh
docker rm dev
```

Or use it at a later time and continue from where you left off:

```sh
docker start -a devhshel
```

## Port Numbers

<table data-full-width="false"><thead><tr><th width="216">Service</th><th width="141">Port Number</th></tr></thead><tbody><tr><td>Kafka broker</td><td>9092</td></tr><tr><td>Kafka connect</td><td>8083</td></tr><tr><td>Zookeeper</td><td>2181</td></tr><tr><td>Schema Registry</td><td>8081</td></tr><tr><td>Lenses</td><td>3030</td></tr><tr><td>Elasticsearch</td><td>9200</td></tr><tr><td>Kafka broker JMX</td><td>9581</td></tr><tr><td>Schema registry JMX</td><td>9582</td></tr><tr><td>Kafka connect JMX</td><td>9584</td></tr><tr><td>Zookeeper JMX</td><td>9585</td></tr><tr><td>Kafka broker (ssl)</td><td>9092</td></tr></tbody></table>

## Advanced options <a href="#advanced-options" id="advanced-options"></a>

<table><thead><tr><th width="280">Variable</th><th>Description</th></tr></thead><tbody><tr><td>ADV_HOST=[ip-address]</td><td>The ip address that the broker will advertise</td></tr><tr><td>DEBUG=1</td><td>Prints all stdout and stderr processes to container’s stdout for debugging.</td></tr><tr><td>DISABLE_JMX=1</td><td>Disables exposing JMX metrics on Kafka services.</td></tr><tr><td>ELASTICSEARCH_PORT=0</td><td>Will not start Elasticsearch.</td></tr><tr><td>ENABLE_SSL=1</td><td>Creates CA and key-cert pairs and makes the broker also listen to SSL://127.0.0.1:9093</td></tr><tr><td>KAFKA_BROKER_ID=1</td><td>Overrides the broker id (the default id is 101).</td></tr><tr><td>SAMPLEDATA=0</td><td>Disables the synthetic streaming data generator that are running by default.</td></tr><tr><td>SUPERVISORWEB=1</td><td>Enables supervisor interface on port 9001 (adjust via SUPERVISORWEB_PORT) to control services.</td></tr></tbody></table>

## FAQ <a href="#faq" id="faq"></a>

### How can I run offline? <a href="#how-can-i-run-offline" id="how-can-i-run-offline"></a>

Download your key locally and run the command:

```bash
LFILE=`cat license.json`
docker run --rm -it -p 3030:3030 -e LICENSE="$LFILE" lensesio/box:latest
```

### How much memory to allocate? <a href="#how-much-memory-to-allocate" id="how-much-memory-to-allocate"></a>

The container is running multiple services, and it is recommended to allocate 5GB of RAM to the docker (although it can operate with even less than 4GB).

To reduce the memory footprint, it is possible to disable some connectors and shrink the Kafka Connect heap size by applying these options (choose connectors to keep) to the `docker run` command:

{% code fullWidth="false" %}

```sh

-e DISABLE=azure-documentdb,cassandra,elastic5,ftp,influxdb,jms,mongodb,mqtt,redis
-e CONNECT_HEAP=512m
```

{% endcode %}


---

# 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.lenses.io/latest/devx/5.5/deployment/installation/lenses-box.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.
