Docker Installation
Docker Installation
Section titled “Docker Installation”Deploy SSH-KLM using Docker Compose for development, testing, or small production environments.
Use Cases
Section titled “Use Cases”- Development and testing environments
- Proof of concept deployments
- Small-scale production (< 100 hosts)
- Quick evaluation of SSH-KLM features
Prerequisites
Section titled “Prerequisites”| Requirement | Version | Notes |
|---|---|---|
| Docker | 20.10+ | docker --version |
| Docker Compose | 2.0+ | docker compose version |
| Memory | 4 GB+ | Available RAM |
| Disk | 20 GB+ | For images and data |
Step-by-Step Guide
Section titled “Step-by-Step Guide”Step 1: Download Configuration
Section titled “Step 1: Download Configuration”# Create project directorymkdir ssh-klm && cd ssh-klm
# Download docker-compose.ymlcurl -o docker-compose.yml \ https://raw.githubusercontent.com/qcecuring/ssh-klm/main/docker-compose.yml
# Download environment templatecurl -o .env.example \ https://raw.githubusercontent.com/qcecuring/ssh-klm/main/.env.exampleStep 2: Configure Environment
Section titled “Step 2: Configure Environment”# Copy environment templatecp .env.example .env
# Edit configurationnano .envKey configuration options:
# .env filePOSTGRES_PASSWORD=your-secure-passwordREDIS_PASSWORD=your-redis-passwordJWT_SECRET=your-jwt-secret-min-32-charsADMIN_EMAIL=admin@yourcompany.comADMIN_PASSWORD=your-admin-passwordStep 3: Start Services
Section titled “Step 3: Start Services”# Pull latest imagesdocker compose pull
# Start all servicesdocker compose up -d
# Verify all services are healthydocker compose psStep 4: Verify Installation
Section titled “Step 4: Verify Installation”# Check API healthcurl http://localhost:8081/health
# Expected response:# {"status":"healthy","version":"2.1.0"}Step 5: Access Dashboard
Section titled “Step 5: Access Dashboard”- Open http://localhost:8081 in your browser
- Login with credentials from
.envfile - Complete initial setup wizard
Docker Compose Configuration
Section titled “Docker Compose Configuration”version: '3.8'
services: api: image: qcecuring/ssh-klm-api:latest ports: - "8081:8081" environment: - DATABASE_URL=postgres://postgres:${POSTGRES_PASSWORD}@db:5432/sshklm - REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379 - JWT_SECRET=${JWT_SECRET} depends_on: - db - redis restart: unless-stopped
worker: image: qcecuring/ssh-klm-worker:latest environment: - DATABASE_URL=postgres://postgres:${POSTGRES_PASSWORD}@db:5432/sshklm - REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379 depends_on: - db - redis restart: unless-stopped
db: image: postgres:14-alpine volumes: - postgres_data:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=sshklm restart: unless-stopped
redis: image: redis:7-alpine command: redis-server --requirepass ${REDIS_PASSWORD} volumes: - redis_data:/data restart: unless-stopped
volumes: postgres_data: redis_data:Examples
Section titled “Examples”Production-Ready Configuration
Section titled “Production-Ready Configuration”version: '3.8'
services: api: image: qcecuring/ssh-klm-api:2.1.0 # Pin version deploy: resources: limits: cpus: '2' memory: 4G logging: driver: json-file options: max-size: "100m" max-file: "5"With External Database
Section titled “With External Database”# .env for external PostgreSQLDATABASE_URL=postgres://user:pass@external-db.example.com:5432/sshklmTroubleshooting
Section titled “Troubleshooting”Container Fails to Start
Section titled “Container Fails to Start”Issue: API container exits immediately
Solution:
# Check logsdocker compose logs api
# Common fix: wait for databasedocker compose downdocker compose up -d db redissleep 10docker compose up -dDatabase Connection Error
Section titled “Database Connection Error”Issue: FATAL: password authentication failed
Solution:
# Reset databasedocker compose down -v # Warning: deletes datadocker compose up -dOut of Memory
Section titled “Out of Memory”Issue: Services killed by OOM
Solution:
# Increase Docker memory limit# Docker Desktop: Settings → Resources → Memory# Linux: Adjust vm.overcommit_memoryMaintenance
Section titled “Maintenance”Backup Data
Section titled “Backup Data”# Backup PostgreSQLdocker compose exec db pg_dump -U postgres sshklm > backup.sql
# Backup volumesdocker run --rm -v ssh-klm_postgres_data:/data -v $(pwd):/backup \ alpine tar czf /backup/postgres-data.tar.gz /dataUpgrade
Section titled “Upgrade”# Pull new imagesdocker compose pull
# Restart with new versiondocker compose up -d
# Verify upgradecurl http://localhost:8081/healthNext Steps
Section titled “Next Steps”- Configure Agent - Install agents on target hosts
- Run First Discovery - Discover SSH keys
- Kubernetes Setup - Scale to production