# 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_HOSTNAME_INGRESS=localhost \
-e CYBUS_TRUST_ALL_CERTS=true \
-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_HOSTNAME_INGRESS=localhost`                  | Specifies the hostname 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.                            |
