> For the complete documentation index, see [llms.txt](https://kchuene.gitbook.io/data-communication-project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kchuene.gitbook.io/data-communication-project/setup/publish-your-docs/services/kali.md).

# Kali

Kali Linux container to run offensive tests on the honeypot and production systems.

## Compose and Deploy

**Compose configuration**

{% code overflow="wrap" lineNumbers="true" %}

```yaml
services:
  kali:
    container_name: kali
    image: kalilinux/kali-rolling:amd64
    # Interactive session when started, prevents immediate exit
    tty: true
    stdin_open: true
    # Restarts even after exiting main shell, unless stopped
    restart: unless-stopped
```

{% endcode %}

{% hint style="info" %}
The container runs the `bash` command when started, then `tty: true` and `stdin_open: true` serve the same purpose as the `-it` options when running `docker exec... bash`
{% endhint %}

**Pull + Create and Run container**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker compose -f kali-compose.yaml pull
sudo docker compose -f kali-compose.yaml up -d
```

{% endcode %}

## Package Installations

**Access the container**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker exec -it kali bash
```

{% endcode %}

**Install default packages**

{% code overflow="wrap" lineNumbers="true" %}

```
apt update && sudo install -y kali-linux-headless
exit
```

{% endcode %}

## Persist Installation

**Create a new image with updates/installations made to the base image**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker commit 983d3e7bbdb2 kali-pkg-installed
```

{% endcode %}

Where `983d3e7bbdb2` would be the id of the **Kali** container.

{% hint style="info" %}
The `commit` command creates a new image from a container's changes.
{% endhint %}

**Update compose and recreate container**

Update the compose configuration to use the new image, i.e. `kali-pkg-installed` and recreate the container with

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker compose -f kali-compose.yaml up --force-recreate
```

{% endcode %}

{% embed url="<https://www.kali.org/docs/containers/official-kalilinux-docker-images/>" %}

{% embed url="<https://hub.docker.com/r/kalilinux/kali-rolling>" %}

{% embed url="<https://bugs.kali.org/view.php?id=9085>" %}

{% embed url="<https://www.youtube.com/watch?v=JmF628xGk1A>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kchuene.gitbook.io/data-communication-project/setup/publish-your-docs/services/kali.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
