Overview
Hawser provides two connection modes:Standard Mode
Direct HTTP/HTTPS connection with token authentication. Use for hosts accessible via direct TCP.
Edge Mode
WebSocket-based connection for NAT traversal. Perfect for edge devices, home labs, and private networks.
Architecture
Standard Mode
In Standard mode, Hawser acts as a reverse proxy, forwarding authenticated requests to the local Docker daemon.Edge Mode
In Edge mode, Hawser establishes an outbound WebSocket connection, enabling bidirectional communication without inbound ports.Installation
Hawser is distributed as a single binary for Linux, macOS, and Windows.- Docker
- Linux
- macOS
- Windows
Run Hawser as a container:
Configuration
Generating Tokens
Select Hawser mode
Choose connection type:
- Hawser Standard: For direct HTTP access
- Hawser Edge: For WebSocket connections (recommended)
Environment Variables
Standard Mode Configuration
For Standard mode, configure the agent to listen on a port:WebSocket Protocol
Hawser Edge uses a JSON-based WebSocket protocol for bidirectional communication.Message Types
hello
hello
Sent by agent on connection:
welcome
welcome
Sent by server after authentication:
request
request
Docker API request from server:
response
response
Response from agent:
metrics
metrics
System metrics from agent:
ping/pong
ping/pong
Heartbeat messages:
Features
Automatic Reconnection
Hawser automatically reconnects to the Dockhand server if the connection is lost. It uses exponential backoff to avoid overwhelming the server:- Initial retry: 1 second
- Maximum retry interval: 60 seconds
- Backoff multiplier: 2x
Container Event Forwarding
Hawser monitors Docker events and forwards them to Dockhand in real-time:Metrics Collection
Hawser collects and reports host metrics every 30 seconds:- CPU usage (per core and total)
- Memory usage (used/total)
- Disk usage
- Network I/O
- Uptime
Docker Compose Support
Hawser supports Docker Compose operations through a special endpoint:Monitoring
Connection Status
View active Hawser connections in Dockhand:- Navigate to Settings > Environments
- Check the Status column for connected agents
- Click View Details to see:
- Agent version
- Docker version
- Last seen timestamp
- Uptime
- Capabilities
Health Check Endpoint
In Standard mode, Hawser exposes a health check endpoint:Troubleshooting
Agent won't connect
Agent won't connect
- Verify
DOCKHAND_SERVER_URLis correct and reachable - Check token is valid and not expired
- Ensure firewall allows outbound WebSocket connections (port 443 for HTTPS)
- Review agent logs:
journalctl -u hawser -f - Test connectivity:
curl https://dockhand.example.com/api/hawser/connect
Connection keeps dropping
Connection keeps dropping
- Check network stability between agent and server
- Verify no proxy or load balancer is terminating WebSocket connections
- Increase WebSocket timeout on reverse proxy if applicable
- Review server logs for error messages
Docker commands fail
Docker commands fail
- Verify Docker socket path is correct (
DOCKER_HOST) - Ensure Hawser has permission to access Docker socket
- For containers, mount socket:
-v /var/run/docker.sock:/var/run/docker.sock - Check Docker daemon is running:
docker ps
Metrics not appearing
Metrics not appearing
- Verify agent capabilities include “metrics”
- Check agent logs for metric collection errors
- Ensure agent has permission to read system metrics
- Metrics are reported every 30 seconds, wait for next interval
Security Considerations
- Token rotation: Regenerate tokens periodically (every 90 days)
- Network security: Use HTTPS for server URL (enforces TLS for WebSocket)
- Access control: Create separate environments/tokens for different hosts
- Monitoring: Enable audit logging to track all Docker API calls
- Minimal privileges: Run Hawser with minimal required permissions
Advanced Configuration
Custom Docker Socket
For non-standard Docker installations:Behind Corporate Proxy
Configure HTTP proxy for WebSocket connections:Custom CA Certificates
For self-signed certificates:API Reference
For detailed API information, see:- Token Management:
/api/hawser/tokens - Connection Status:
/api/hawser/connect - WebSocket Endpoint:
wss://your-server/api/hawser/connect
Next Steps
Remote Hosts
Configure direct TLS connections
Webhooks
Set up Git webhooks for automatic deployments
