# Docker Container

## Preflight Check

If you'd like to verify your environment's compatibility, use the [following script](https://github.com/qpoint-io/preflight/tree/main):

{% code overflow="wrap" %}

```bash
curl -sSL https://github.com/qpoint-io/preflight/releases/latest/download/preflight.sh | sudo bash
```

{% endcode %}

## Prerequisites

* A Linux host with supported kernel (5.10+)
* `Docker`. For installation instructions, refer to the [Docker official documentation](https://docs.docker.com/get-docker/).
* [Qtap YAML config file](/getting-started/qtap/configuration.md)

## Installation Steps

Download the latest Docker Image:

```bash
docker pull us-docker.pkg.dev/qpoint-edge/public/qtap:v0
```

### Running Qtap in Docker

{% tabs %}
{% tab title="Local Only" %}

```bash
docker run \
  --user 0:0 \
  --privileged \
  --cap-add CAP_BPF \
  --cap-add CAP_SYS_ADMIN \
  --pid=host \
  --network=host \
  -v /sys:/sys \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v "$(pwd):/app/config" \
  -e TINI_SUBREAPER=1 \
  --ulimit=memlock=-1 \
  us-docker.pkg.dev/qpoint-edge/public/qtap:v0 \
  --log-level=info \
  --log-encoding=console \
  --config=/app/config/qpoint.yaml
```

Replace `/app/config/qpoint.yaml` with the actual path to your YAML configuration file inside the container. You can exclude this for testing, and Qtap will run in a default configuration. Make sure to mount your local configuration file to this path using the `-v` option.
{% endtab %}
{% endtabs %}

## Docker Run Command Options Explained

1. `--user 0:0`: Runs the container as root (necessary for eBPF operations).
2. `--privileged`: Gives extended privileges to this container.
3. `--cap-add CAP_BPF`: Adds the CAP\_BPF capability (required for eBPF operations).
4. `--cap-add CAP_SYS_ADMIN`: Adds the CAP\_SYS\_ADMIN capability (for low-level system operations).
5. `--pid=host`: Shares the host's PID namespace with the container.
6. `--network=host`: Uses the host's network stack inside the container.
7. `-v /sys:/sys`: Mounts the host's /sys directory into the container.
8. `-v /var/run/docker.sock:/var/run/docker.sock:` Mounts the host's docker socket
9. `-v "$(pwd):/app/config"`: Mounts the current directory to /app/config in the container.
10. `-e TINI_SUBREAPER=1`: Sets up Tini as a subreaper for proper signal handling.
11. `--ulimit=memlock=-1`: Removes the memory lock limit for eBPF programs.

## Qtap-specific Flags

* `--log-level=info`: Sets the logging level (debug, info, warn, error).
* `--log-encoding=console`: Sets the log encoding format.
* `--registration-token=$TOKEN`: (Cloud-connected mode) Provides the registration token for Qtap.
* `--config=/app/config/qpoint.yaml`: (Local mode) Specifies the path to the Qtap configuration file.

## Available Flags and Options

To see all available options and flags, run:

```bash
docker run --rm us-docker.pkg.dev/qpoint-edge/public/qtap:v0 --help
```


---

# 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.qpoint.io/getting-started/qtap/installation/docker-container.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.
