Garazyk Laweta — Docker Infrastructure
Generic Docker Engine API client over Unix socket with Compose, health, events, and stats. No ATProto-specific code — protocol orchestration lives in hamownia.
When to Use
- Create a Docker API client or interact with the Docker daemon
- Bring up or tear down Docker Compose stacks
- Wait for services to become healthy (HTTP or container health)
- Watch container events (health transitions, crashes, state changes)
- Sample container CPU/memory stats
- Detect port conflicts or stale Docker projects
Quick Start
import {
createDockerClient,
composeUp,
composeDown,
waitForService,
ContainerEventWatcher,
ContainerStatsSampler,
} from "@garazyk/laweta";
Compose subpath:
import { composeProjectName, composeServiceName } from "@garazyk/laweta/compose";
API Reference
Docker Client
| Export |
Type |
Description |
createDockerClient(opts?) |
function → DockerApiClient |
Create client over Unix socket; falls back to CLI |
DockerApiClient |
class |
Docker Engine API v1.43 client |
DockerApiError |
class |
Error from Docker API calls |
DockerApiClientOptions |
type |
{ endpoint?, dockerHost?, homeDir? } — all optional |
Compose
| Export |
Type |
Description |
composeUp(file, project, opts?) |
async function |
Start a Compose stack |
composeDown(file, project, opts?) |
async function |
Stop a Compose stack |
composeProjectName(name) |
function |
Normalize a project name |
composeServiceName(project, service) |
function |
Build a Compose service name |
Health Checks
| Export |
Type |
Description |
waitForHttp(url, label, timeout?, headers?) |
async → boolean |
Poll HTTP endpoint until 2xx |
waitForService(name, project, file, timeout?, watcher?) |
async → boolean |
Event-driven health check |
waitForServiceCLI(name, project, file, timeout?) |
async → boolean |
CLI-based health check fallback |
Container Events
| Export |
Type |
Description |
ContainerEventWatcher.create(opts?) |
async → ContainerEventWatcher? |
Create event watcher (null if no socket) |
DockerEventParser |
class |
Parse Docker event stream |
buildContainerEventFilters(services) |
function |
Build event filter for services |
Container Stats
| Export |
Type |
Description |
ContainerStatsSampler |
class |
Periodic CPU/memory sampler |
cpuPercent(stats) |
function |
Calculate CPU percentage |
memoryUsage(stats) |
function |
Get memory usage bytes |
memoryLimit(stats) |
function |
Get memory limit bytes |
formatMemory(bytes) |
function |
Format bytes human-readable |
healthStatus(inspect) |
function |
Extract health status from inspect |
Port & Project Detection
| Export |
Type |
Description |
findPortConflicts(ports) |
async → PortConflict[] |
Find ports already in use |
findStaleProjectsOnPorts(ports) |
async → string[] |
Find stale Docker projects on ports |
Log Parsing
| Export |
Type |
Description |
parseDockerLogBuffer(buf, isStderr) |
function |
Parse Docker log stream frames |
Key Patterns
Create a client and check Docker version
const docker = createDockerClient();
const version = await docker.version();
console.log(version.ApiVersion);
Bring up a Compose stack and wait for health
await composeUp("docker-compose.yml", "my-project");
const watcher = await ContainerEventWatcher.create();
const ok = await waitForService("pds", "my-project", "docker-compose.yml", 60, watcher);
Sample container stats
const sampler = new ContainerStatsSampler(docker, "my-container", { intervalMs: 1000 });
sampler.start();
// ... later
const snapshot = sampler.latest();
console.log(`CPU: ${cpuPercent(snapshot)}%, Mem: ${formatMemory(memoryUsage(snapshot))}`);
sampler.stop();
Detect port conflicts before starting
const conflicts = await findPortConflicts([2583, 2584]);
if (conflicts.length > 0) {
console.log("Port conflicts:", conflicts.map(c => `${c.port} → ${c.process}`));
}
Boundary Rules
Laweta can only import from gruszka and laweta. No ATProto-specific code — all protocol orchestration lives in hamownia.
Related Skills
- garazyk-hamownia — scenario orchestration that uses laweta for Docker
- garazyk-schemat — topology definitions that produce compose configs
- garazyk-narzedzia — boundary checker enforces laweta's import rules
Source: jvalinsky/garazyk — distributed by TomeVault.
1---2name: garazyk-laweta3description: Generic Docker Engine API client, Compose lifecycle, health checks, event watching, and container stats from the @garazyk/laweta Deno package. Use when working with Docker containers, compose stacks, service health, container events, or resource stats in the Garazyk monorepo. Use when this capability is needed.4---56# Garazyk Laweta — Docker Infrastructure78Generic Docker Engine API client over Unix socket with Compose, health, events, and stats. No ATProto-specific code — protocol orchestration lives in hamownia.910## When to Use1112- Create a Docker API client or interact with the Docker daemon13- Bring up or tear down Docker Compose stacks14- Wait for services to become healthy (HTTP or container health)15- Watch container events (health transitions, crashes, state changes)16- Sample container CPU/memory stats17- Detect port conflicts or stale Docker projects1819## Quick Start2021```ts22import {23 createDockerClient,24 composeUp,25 composeDown,26 waitForService,27 ContainerEventWatcher,28 ContainerStatsSampler,29} from "@garazyk/laweta";30```3132Compose subpath:3334```ts35import { composeProjectName, composeServiceName } from "@garazyk/laweta/compose";36```3738## API Reference3940### Docker Client4142| Export | Type | Description |43|--------|------|-------------|44| `createDockerClient(opts?)` | function → `DockerApiClient` | Create client over Unix socket; falls back to CLI |45| `DockerApiClient` | class | Docker Engine API v1.43 client |46| `DockerApiError` | class | Error from Docker API calls |47| `DockerApiClientOptions` | type | `{ endpoint?, dockerHost?, homeDir? }` — all optional |4849### Compose5051| Export | Type | Description |52|--------|------|-------------|53| `composeUp(file, project, opts?)` | async function | Start a Compose stack |54| `composeDown(file, project, opts?)` | async function | Stop a Compose stack |55| `composeProjectName(name)` | function | Normalize a project name |56| `composeServiceName(project, service)` | function | Build a Compose service name |5758### Health Checks5960| Export | Type | Description |61|--------|------|-------------|62| `waitForHttp(url, label, timeout?, headers?)` | async → `boolean` | Poll HTTP endpoint until 2xx |63| `waitForService(name, project, file, timeout?, watcher?)` | async → `boolean` | Event-driven health check |64| `waitForServiceCLI(name, project, file, timeout?)` | async → `boolean` | CLI-based health check fallback |6566### Container Events6768| Export | Type | Description |69|--------|------|-------------|70| `ContainerEventWatcher.create(opts?)` | async → `ContainerEventWatcher?` | Create event watcher (null if no socket) |71| `DockerEventParser` | class | Parse Docker event stream |72| `buildContainerEventFilters(services)` | function | Build event filter for services |7374### Container Stats7576| Export | Type | Description |77|--------|------|-------------|78| `ContainerStatsSampler` | class | Periodic CPU/memory sampler |79| `cpuPercent(stats)` | function | Calculate CPU percentage |80| `memoryUsage(stats)` | function | Get memory usage bytes |81| `memoryLimit(stats)` | function | Get memory limit bytes |82| `formatMemory(bytes)` | function | Format bytes human-readable |83| `healthStatus(inspect)` | function | Extract health status from inspect |8485### Port & Project Detection8687| Export | Type | Description |88|--------|------|-------------|89| `findPortConflicts(ports)` | async → `PortConflict[]` | Find ports already in use |90| `findStaleProjectsOnPorts(ports)` | async → `string[]` | Find stale Docker projects on ports |9192### Log Parsing9394| Export | Type | Description |95|--------|------|-------------|96| `parseDockerLogBuffer(buf, isStderr)` | function | Parse Docker log stream frames |9798## Key Patterns99100### Create a client and check Docker version101102```ts103const docker = createDockerClient();104const version = await docker.version();105console.log(version.ApiVersion);106```107108### Bring up a Compose stack and wait for health109110```ts111await composeUp("docker-compose.yml", "my-project");112const watcher = await ContainerEventWatcher.create();113const ok = await waitForService("pds", "my-project", "docker-compose.yml", 60, watcher);114```115116### Sample container stats117118```ts119const sampler = new ContainerStatsSampler(docker, "my-container", { intervalMs: 1000 });120sampler.start();121// ... later122const snapshot = sampler.latest();123console.log(`CPU: ${cpuPercent(snapshot)}%, Mem: ${formatMemory(memoryUsage(snapshot))}`);124sampler.stop();125```126127### Detect port conflicts before starting128129```ts130const conflicts = await findPortConflicts([2583, 2584]);131if (conflicts.length > 0) {132 console.log("Port conflicts:", conflicts.map(c => `${c.port} → ${c.process}`));133}134```135136## Boundary Rules137138Laweta can only import from `gruszka` and `laweta`. No ATProto-specific code — all protocol orchestration lives in hamownia.139140## Related Skills141142- **garazyk-hamownia** — scenario orchestration that uses laweta for Docker143- **garazyk-schemat** — topology definitions that produce compose configs144- **garazyk-narzedzia** — boundary checker enforces laweta's import rules145146---147> Source: [jvalinsky/garazyk](https://github.com/jvalinsky/garazyk) — distributed by [TomeVault](https://tomevault.io).148<!-- tomevault:4.0:skill_md:2026-06-15 -->