Skip to main content

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

FunctionDescriptionDocker API
listContainers()List all containers (running + stopped)GET /containers/json?all=true
start(id)Start a stopped containerPOST /containers/{id}/start
stop(id)Stop a running containerPOST /containers/{id}/stop
restart(id)Restart a containerPOST /containers/{id}/restart
remove(id)Remove a stopped containerDELETE /containers/{id}
logs(id)Stream container logs (real-time)GET /containers/{id}/logs?follow=true
stats(id)Get container resource usageGET /containers/{id}/stats
inspect(id)Get detailed container infoGET /containers/{id}/json
images()List Docker imagesGET /images/json
systemInfo()Get Docker system informationGET /info

Docker Manager UI

The Docker Manager page shows all containers in a table with real-time status updates:

ColumnDataSource
NameContainer namecontainer.Names[0]
ImageDocker imagecontainer.Image
StatusRunning / Stopped / Exitedcontainer.State
CPUCPU usage percentagestats() via Socket.IO
MemoryMemory usage (MB / limit)stats() via Socket.IO
PortsMapped portscontainer.Ports
CreatedCreation timestampcontainer.Created
ActionsStart, Stop, Restart, Remove, LogsButtons

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:

FieldContent
userIdWho performed the action
actioncontainer:start, container:stop, container:restart, container:remove
resourceContainer name and ID
detailsAdditional context (image, previous state)
timestampWhen the action occurred
Destructive Actions

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

EndpointMethodDescription
/api/docker/containersGETList all containers
/api/docker/containers/:id/startPOSTStart container
/api/docker/containers/:id/stopPOSTStop container
/api/docker/containers/:id/restartPOSTRestart container
/api/docker/containers/:id/removeDELETERemove container
/api/docker/containers/:id/logsGETGet container logs
/api/docker/containers/:id/statsGETGet container stats
/api/docker/containers/:id/inspectGETGet container details
/api/docker/imagesGETList images
/api/docker/systemGETDocker system info

All endpoints require JWT authentication.


Image Management

The Images view shows all Docker images with:

ColumnDescription
Repository:TagImage identifier
SizeImage size
CreatedBuild date
Used ByContainers using this image
ActionsDelete unused images

Cross-Reference