Overview
Environments in Dockhand represent individual Docker hosts that you can manage. Each environment can connect to Docker via Unix socket (local), TCP/TLS (remote), or Hawser (our secure edge agent). This enables managing multiple Docker hosts from a single Dockhand instance.Key Features
Environment Types
Socket Connection (Local):- Connects to Docker via Unix socket
- Default path:
/var/run/docker.sock - Requires Docker socket to be mounted in Dockhand container
- Zero network overhead
- Most secure for local Docker
- Connects to Docker daemon over network
- HTTP or HTTPS with TLS certificates
- Configure host, port, and protocol
- Supports mutual TLS authentication
- Good for trusted networks
- Hawser agent connects to Dockhand
- Agent polls for commands
- Dockhand waits for agent connection
- NAT/firewall friendly (outbound only from agent)
- Secure token-based authentication
- Dockhand connects to Hawser agent
- Agent provides endpoint for Dockhand
- Useful when Dockhand is in restricted network
- Same security as Hawser Standard
Environment Management
Create Environments:- Add new Docker hosts
- Configure connection settings
- Test connection before saving
- Set environment name and icon
- Organize with labels
- Switch between environments
- Test connectivity
- Edit connection settings
- View environment details
- Remove environments
- Verify Docker API access
- Check Docker version
- Count containers and images
- Display host information
- Show error messages on failure
Environment Settings
Per-Environment Configuration:- Public IP: For generating clickable port links
- Activity Collection: Enable/disable Docker event tracking
- Metrics Collection: Enable/disable host metrics (CPU, memory)
- Highlight Changes: Visual highlighting of resource changes
- Labels: Categorize environments (production, staging, dev)
- Icon: Visual identifier for environment
UI Features
Environment Selector:- Dropdown in top navigation
- Shows current environment
- Quick switch between environments
- Color-coded by environment
- Visual grid layout
- Connection status indicator
- Quick test button
- Edit and delete actions
- Docker version and stats
How to Use
Adding a Local Environment
- Click Add environment button
- Basic Information:
- Name: “Local Docker”
- Connection Type: Socket (default)
- Socket Configuration:
- Socket Path:
/var/run/docker.sock(default)
- Socket Path:
- Click Test to verify connection
- Click Add to save
- Docker socket must be mounted in Dockhand container
- Add to docker-compose.yml:
Adding a Remote Environment (TCP)
- Click Add environment
- Basic Information:
- Name: “Production Server”
- Connection Type: Direct
- Quick URL (optional):
- Paste full Docker URL:
https://192.168.1.100:2376 - Click Parse to auto-fill fields
- Paste full Docker URL:
- Or Configure Manually:
- Host:
192.168.1.100ordocker.example.com - Port:
2376(TLS) or2375(plain) - Protocol: HTTPS or HTTP
- Host:
- TLS Configuration (if HTTPS):
- Paste CA certificate
- Paste client certificate
- Paste client key
- Click Test to verify
- Click Add to save
Adding a Hawser Environment
- Click Add environment
- Basic Information:
- Name: “Remote Site”
- Connection Type: Hawser Standard or Hawser Edge
- Hawser Configuration:
- Connection Type: Hawser Standard (agent connects to Dockhand)
- Or: Hawser Edge (Dockhand connects to agent)
- Click Add to save
- Generate Token:
- Navigate to Settings > Hawser
- Create token for this environment
- Copy token
- Deploy Hawser Agent:
- Install Hawser on remote Docker host
- Configure with Dockhand URL and token
- Start agent
- Agent connects automatically
- Environment shows “Connected” status
Switching Environments
- Click environment dropdown in top navigation
- Select target environment from list
- All pages refresh with new environment data
- Current environment shown in dropdown
Testing Connectivity
- Navigate to Environments page
- Find environment card
- Click Test button
- Success shows:
- Green indicator
- Docker version
- Container and image counts
- Host name
- Failure shows:
- Red indicator
- Error message
- Troubleshooting hints
Editing an Environment
- Click Edit icon on environment card
- Modify settings:
- Name
- Connection details
- TLS certificates (if applicable)
- Click Test to verify changes
- Click Save to update
Removing an Environment
- Click Remove icon on environment card
- Confirm deletion
- Environment removed from Dockhand
- Note: Does not affect Docker host itself
UI Walkthrough
Header Section
- Title: “Environments” with count badge
- Add Environment Button: Opens creation modal
- Refresh Button: Reload environment list
Environment Cards
Card Layout:- Icon: Globe icon with environment name
- Connection Info:
- Socket: Shows socket path
- Direct: Shows protocol://host:port
- Hawser Edge: Shows “Edge connection (outbound)”
- Hawser Standard: Shows “Standard connection (inbound)”
- Status Indicator:
- Testing: Spinner animation
- Connected: Green checkmark with “Connected”
- Failed: Red X with “Failed”
- Details (on success):
- Host name
- Docker version
- Container count
- Image count
- Error Message (on failure):
- Specific error text
- Troubleshooting hints
- Test: Verify connection
- Edit: Modify configuration
- Remove: Delete environment
Add/Edit Environment Modal
Sections:-
Quick URL Parser (optional):
- Input field for full Docker URL
- Parse button to auto-fill fields
- Helpful for Direct connections
-
Basic Info:
- Name (required)
- Connection Type (required)
-
Socket Configuration (if Socket type):
- Socket path
-
Direct Configuration (if Direct type):
- Host
- Port
- Protocol (HTTP/HTTPS dropdown)
-
TLS Certificates (if HTTPS):
- CA certificate textarea
- Client certificate textarea
- Client key textarea
-
Hawser Configuration (if Hawser type):
- Connection type info
- Token management link
- Cancel: Close without saving
- Test: Verify connection settings
- Add/Save: Create or update environment
Real Examples
Example: Local Development
Example: Production Server
Example: Remote Site with Hawser
Example: Multi-Environment Setup
Database Schema
environments table:id: Auto-incrementing primary keyname: Unique environment namehost: Hostname or IP address (for TCP)port: Port number (for TCP)protocol: http or https (for TCP)tlsCa: CA certificate (for TLS)tlsCert: Client certificate (for TLS)tlsKey: Client key (for TLS)tlsSkipVerify: Skip TLS verification (not recommended)connectionType: socket, direct, hawser-standard, hawser-edgesocketPath: Unix socket path (for socket type)hawserToken: Authentication token (for Hawser)hawserLastSeen: Last agent connection timestamphawserAgentId: Agent identifierhawserAgentName: Agent hostnamehawserVersion: Agent versionhawserCapabilities: Agent feature listpublicIp: Public IP for port linkscollectActivity: Enable Docker event collectioncollectMetrics: Enable host metrics collectionhighlightChanges: Enable change highlightinglabels: JSON array of labelsicon: Icon identifiercreatedAt: Creation timestampupdatedAt: Last update timestamp
id: Auto-incrementing primary keytoken: Hashed token (secure storage)tokenPrefix: First 8 chars for identificationname: Token nameenvironmentId: Foreign key to environmentsisActive: Active status flaglastUsed: Last usage timestampcreatedAt: Creation timestampexpiresAt: Expiration timestamp (optional)
Technical Details
Connection Types
Socket:- Uses Docker SDK with Unix socket
- Path:
/var/run/docker.sock - Requires socket mount in container
- No authentication needed
- Uses Docker SDK with HTTP/HTTPS client
- TLS verification with certificates
- Mutual TLS authentication
- Standard Docker Remote API
- WebSocket-based communication
- Agent polls Dockhand for commands
- Long-polling with command queue
- Response streaming for logs/exec
- Similar to Hawser Standard
- Direction reversed (Dockhand initiates)
- Useful for restricted networks
Security Considerations
Socket:- Full Docker access
- Equivalent to root on host
- Use read-only mount where possible
- Use TLS/HTTPS in production
- Never use HTTP over public networks
- Verify certificates
- Rotate credentials regularly
- Token-based authentication
- Tokens stored hashed in database
- Set expiration dates
- Revoke compromised tokens immediately
Performance
Connection Pooling:- Docker clients cached per environment
- Reused across API requests
- Timeout after 30s idle
- Periodic ping to verify connectivity
- Automatic reconnection on failure
- Status shown in UI
API Endpoints
GET /api/environments- List all environmentsPOST /api/environments- Create environmentGET /api/environments/:id- Get environment detailsPUT /api/environments/:id- Update environmentDELETE /api/environments/:id- Remove environmentPOST /api/environments/:id/test- Test connection
