# Installing Agents via Docker

The following explains how to install agents via the `docker run`command using an example.

In this example, we will install an agent named `myAgent` that persists data to `/tmp/cybus` on the host system.

* In your terminal, enter the following command using to install an agent. For the `IMAGE_TAG`variable, make sure to specify the image version that you want to use for the protocol-mapper agent. For example, `1.7.0`.
  * Optional: To run the agent with root permissions, add the parameter `--user=root` to the `docker run` command.

For more information on the parameters, see [Parameters for Installing Agents via Docker](#parameters-for-installing-agents-via-docker)

{% code lineNumbers="true" %}

```yaml
docker run \
-e CYBUS_AGENT_MODE=distributed \
-e CYBUS_AGENT_NAME=myAgent \
-e CYBUS_MQTT_HOST=10.11.12.13 \
-v /tmp/cybus:/data \
--restart unless-stopped \
--net=host \
--hostname=${HOSTNAME} \
registry.cybus.io/cybus/protocol-mapper:${IMAGE_TAG}
```

{% endcode %}

**Result:** The agent is installed.

## Parameters for Installing Agents via Docker

The following parameters are used to install agents via Docker.

| Parameter                                              | Description                                                                                      |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `-e CYBUS_AGENT_MODE=distributed`                      | This sets the agent to run in distributed mode.                                                  |
| `-e CYBUS_AGENT_NAME=myAgent`                          | Defines the agent name, which must match the `agentName` used in the service commissioning file. |
| `-e CYBUS_MQTT_HOST=10.11.12.13`                       | Specifies the IP address of the Connectware instance.                                            |
| `-v /tmp/cybus:/data`                                  | Mounts a volume to allow the agent to persist data across restarts.                              |
| `--restart unless-stopped`                             | Ensures the container automatically restarts after failures.                                     |
| `--net=host`                                           | Uses host mode networking for the container.                                                     |
| `--hostname=${HOSTNAME}`                               | Assigns a hostname to the container for easier identification.                                   |
| `registry.cybus.io/cybus/protocol-mapper:${IMAGE_TAG}` | Specifies the image version to be used for the protocol-mapper agent.                            |


---

# 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.cybus.io/1-8-0/documentation/agents/installing-agents/installing-agents-via-docker.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.
