Docker
This guide walks you through installing the Infrastructure Agent (Infra Agent) on a host via Docker. These instructions can also be found on the Installation page in the Middleware platform.
The Docker Infra Agent is a containerized version of the Infra Agent. Upon installation, the Infra Agent collects host level details using Docker's bridge gateway and uses volume binding to read logs.
Step 1: Run the Docker Install Command
Option 1: Run the Command Normally
Copy and run the installation command. If the values for MW_API_KEY
and MW_TARGET
are not visible, either log in or copy the command directly from the Installation page to ensure your MW_API_KEY
and MW_TARGET
are correct.
MW_API_KEY="<MW_API_KEY>" MW_TARGET=https://<MW_UID>.middleware.io:443 bash -c "$(curl -L https://install.middleware.io/scripts/docker-install.sh)"
Option 2: Run the Command With Host Tags [Optional]
Create filterable custom tags by adding the MW_HOST_TAGS
environment variable to the installation command as comma-separated key-value pairs. Use the tag name
to create an alias for the host (e.g. name:load-balancer1
).
Check your host tags have been embedded by navigating to Infrastructure -> Your Desired Host -> System Information
MW_HOST_TAGS=key1:value1,key2:value2,... MW_API_KEY="<MW_API_KEY>" MW_TARGET=https://<MW_UID>.middleware.io:443 bash -c "$(curl -L https://install.middleware.io/scripts/docker-install.sh)"
Step 2: Verify Installation
Verify the status of the Docker Infra Agent. If the status is UP
or Exited
, the installation was successful. If the status is blank, the installation was unsuccessful. Run the following command to verify the Infra Agent's status:
Shell
docker ps -a --filter ancestor=ghcr.io/middleware-labs/mw-host-agent:master
Step 3: Check Your Dashboard
Navigate to the Middleware platform and ensure that the host and it's metrics appear in the Installation page. It can take up to a few minutes for metrics to first appear. If metrics do not appear after a few minutes, head to our troubleshooting section for common issues.
Docker Compose
To run the container with Docker Compose or to review the necessary ports, volumes, privileges, and network mode for running it, please refer to the Docker Compose file below for more details.
version: "3.8" services: mw-host-agent: image: ghcr.io/middleware-labs/mw-host-agent:master environment: - MW_API_KEY=your-initial-token - MW_TARGET=your-initial-uid ports: - 9319:9319 - 9320:9320
Troubleshooting
Run only one Infra Agent per host. Multiple agents will cause unexpected behavior.
Once the Infra Agent is installed, metrics should appear in the Middleware platform within a few minutes. If metrics do not appear, confirm that the host has access to the internet, either directly or through a proxy, and that only one Infra Agent per container is running.
Uninstall
To uninstall the Infra Agent use the following commands:
Shell
docker stop `docker ps -a -q --filter ancestor=ghcr.io/middleware-labs/mw-host-agent:master` docker rm `docker ps -a -q --filter ancestor=ghcr.io/middleware-labs/mw-host-agent:master`
Need assistance or want to learn more about Middleware? Contact our support team in Slack.