feat: add Docker container monitoring by name

- Update Docker monitoring to support both container names and IDs
- Maintain backward compatibility with existing container ID monitoring
- Add logic to find containers by name (with or without "/" prefix)
- Update frontend UI labels and placeholders to reflect name/ID support
- Update instructions to clarify both name and ID are supported

Resolves user request: "It would be great if we could monitor docker containers by name and not just ID - given that the ID changes when containers are taken down for any reason"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
gorkem-bwlandClaude committed 2025-08-29 00:27:01 -04:00
1 parent 0ad759a384
commit 4693177e4b
2 files changed
+17 -6

No files matched your search

@@ -254,12 +254,23 @@ class NetworkService {
});
const containers = await docker.listContainers({ all: true });
const containerExists = containers.some((c) => c.Id.startsWith(monitor.url));
if (!containerExists) {
// Find container by ID (original behavior) or by name (new feature)
let targetContainer = containers.find((c) => {
// Check if monitor.url matches container ID (partial match)
if (c.Id.startsWith(monitor.url)) {
return true;
}
// Check if monitor.url matches any container name
// Container names are stored as ["/container-name"] in the Names array
return c.Names.some((name) => name === `/${monitor.url}` || name === monitor.url);
});
if (!targetContainer) {
throw new Error(this.stringService.dockerNotFound);
}
const container = docker.getContainer(monitor.url);
const container = docker.getContainer(targetContainer.Id);
const { response, responseTime, error } = await this.timeRequest(() => container.inspect());
const dockerResponse = {