Docker Management
The Control Center provides a web UI for managing Docker containers running the Pulse application. All operations are performed via docker.service.ts and exposed through REST API endpoints and real-time Socket.IO events.
Service Functions
| Function | Description | Docker API |
|---|---|---|
listContainers() | List all containers (running + stopped) | GET /containers/json?all=true |
start(id) | Start a stopped container | POST /containers/{id}/start |
stop(id) | Stop a running container | POST /containers/{id}/stop |
restart(id) | Restart a container | POST /containers/{id}/restart |
remove(id) | Remove a stopped container | DELETE /containers/{id} |
logs(id) | Stream container logs (real-time) | GET /containers/{id}/logs?follow=true |
stats(id) | Get container resource usage | GET /containers/{id}/stats |
inspect(id) | Get detailed container info | GET /containers/{id}/json |
images() | List Docker images | GET /images/json |
systemInfo() | Get Docker system information | GET /info |
Docker Manager UI
The Docker Manager page shows all containers in a table with real-time status updates:
| Column | Data | Source |
|---|---|---|
| Name | Container name | container.Names[0] |
| Image | Docker image | container.Image |
| Status | Running / Stopped / Exited | container.State |
| CPU | CPU usage percentage | stats() via Socket.IO |
| Memory | Memory usage (MB / limit) | stats() via Socket.IO |
| Ports | Mapped ports | container.Ports |
| Created | Creation timestamp | container.Created |
| Actions | Start, Stop, Restart, Remove, Logs | Buttons |
Real-Time Updates
Container status and stats are pushed via the /docker Socket.IO namespace:
// Server: Push container stats every 5 seconds
setInterval(async () => {
const containers = await dockerService.listContainers();
const stats = await Promise.all(
containers
.filter(c => c.State === 'running')
.map(async (c) => ({
id: c.Id,
name: c.Names[0],
stats: await dockerService.stats(c.Id),
}))
);
io.of('/docker').emit('container:stats', stats);
}, 5000);
// Emit on container state changes
docker.getEvents({}, (err, stream) => {
stream.on('data', (event) => {
io.of('/docker').emit('container:status', JSON.parse(event));
});
});
Live Logs
Container logs are streamed in real-time to the browser:
The UI displays logs in a terminal-like interface with:
- Auto-scroll to bottom
- Color-coded output (stdout vs stderr)
- Search/filter functionality
- Download log file option
Audit Trail
All container actions are logged in the AuditLog SQLite table:
| Field | Content |
|---|---|
userId | Who performed the action |
action | container:start, container:stop, container:restart, container:remove |
resource | Container name and ID |
details | Additional context (image, previous state) |
timestamp | When the action occurred |
Container remove operations require confirmation in the UI. The action is logged immediately and cannot be undone. Stopped containers are shown with a visual warning before removal.
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/docker/containers | GET | List all containers |
/api/docker/containers/:id/start | POST | Start container |
/api/docker/containers/:id/stop | POST | Stop container |
/api/docker/containers/:id/restart | POST | Restart container |
/api/docker/containers/:id/remove | DELETE | Remove container |
/api/docker/containers/:id/logs | GET | Get container logs |
/api/docker/containers/:id/stats | GET | Get container stats |
/api/docker/containers/:id/inspect | GET | Get container details |
/api/docker/images | GET | List images |
/api/docker/system | GET | Docker system info |
All endpoints require JWT authentication.
Image Management
The Images view shows all Docker images with:
| Column | Description |
|---|---|
| Repository:Tag | Image identifier |
| Size | Image size |
| Created | Build date |
| Used By | Containers using this image |
| Actions | Delete unused images |
- Control Center Architecture -- overall architecture
- VPS Monitoring -- system-level metrics
- Docker Infrastructure -- Docker Compose configuration
- Deployment -- production Docker deployment