Docker Agent Installation

Install CostGraph agent using Docker or Docker Compose for easy deployment and management.

Prerequisites

  • Docker: Ensure Docker is installed and running on your system.
  • API Key: Obtain an API key from the CostGraph dashboard.
  • Docker Compose (Optional): Install Docker Compose for multi-container deployments.

Installation Methods

1

Create Compose File

Create a docker-compose.yml file with your configuration:
version: '3.8'
services:
  costgraph-agent:
    image: ghcr.io/baselinehq/costgraph-agent:latest
    container_name: costgraph-agent
    restart: unless-stopped
    ports:
      - "9090:9090"
    environment:
      - API_KEY=your-api-key
      - INSTANCE_NAME=my-vm
      - PROMETHEUS_ENDPOINT=http://localhost:9090
      - METRICS_PORT=9090
      - LOG_LEVEL=info
    volumes:
      - ./config:/etc/costgraph
    networks:
      - costgraph-network
  
  # Optional: Add Prometheus for local metrics collection
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    ports:
      - "9091:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    networks:
      - costgraph-network

networks:
  costgraph-network:
    driver: bridge
2

Start Services

Use Docker Compose to start the agent and related services:
# Start all services
docker-compose up -d

# Check service status
docker-compose ps

# View logs
docker-compose logs -f costgraph-agent
3

Verify Deployment

Check that all services are running correctly:
# Check container status
docker ps | grep costgraph-agent

# Verify metrics endpoint
curl http://localhost:9090/metrics

# View logs for troubleshooting
docker logs costgraph-agent

Post Installation

Once your Docker agent is running, head back to your CostGraph dashboard to view your metrics and cost data.