When to Use
- Health monitoring: Enumerate all containers every 5 minutes and alert when any container enters the
exited state unexpectedly.
- Resource inventory: List all running containers to build capacity reports and populate infrastructure dashboards.
- Cleanup automation: Find containers with
State of exited and names matching temporary job patterns, then queue them for batch removal.
- Deployment verification: After a deploy completes, list containers and confirm the expected image tag is actively running.
- Multi-container coordination: Before starting a dependent service, verify that all prerequisite containers are in the
running state.
Configuration
Connection Fields
| Field | Type | Default | Description |
dockerHost | string | unix:///var/run/docker.sock | Docker socket path or TCP endpoint |
connectionType | string | unixsocket | unixsocket | tcp | tcptls |
tlsCertPath | string | — | TLS certificate directory path. Required when connectionType is tcptls. optional |
timeoutSeconds | int | 30 | Operation timeout in seconds. optional |
Operation Fields
| Field | Type | Required | Description |
resource | string | required | Must be container |
operation | string | required | Must be list |
container/list requires no operation-specific input fields. By default it returns all containers (running, stopped, paused). To filter by state, use an If Condition or Function node downstream to filter the output array.
Sample Configuration
{
"resource": "container",
"operation": "list",
"connection": {
"dockerHost": "unix:///var/run/docker.sock",
"connectionType": "unixsocket",
"timeoutSeconds": 30
}
}
Validation Errors
| Error Code | Trigger | Resolution |
CONFIG_ERROR | Docker host URL is malformed or empty | Check dockerHost value. Unix socket must start with unix://. |
AUTH_FAILED | TLS certificate validation failed | Verify tlsCertPath points to valid cert/key/ca files. |
DOCKER_API_ERROR | Docker daemon is not running or socket is inaccessible | Check that Docker daemon is running. Verify socket file permissions. |
UNKNOWN_ROUTE | resource or operation value is incorrect | Ensure both fields are exactly container and list. |
Output
Success Port
| Field | Type | Description |
listContainers | array | Array of container summary objects (one per container) |
listContainers[n].Id | string | Full container ID (64-character hex) |
listContainers[n].Names | string[] | Container name(s) — includes leading / |
listContainers[n].Image | string | Image name and tag used to create the container |
listContainers[n].Status | string | Human-readable status string (e.g. Up 3 hours) |
listContainers[n].State | string | Machine-readable state: running | exited | paused | restarting |
listContainers[n].Created | number | Unix timestamp of container creation |
listContainers[n].Ports | array | Port mapping objects — PrivatePort, PublicPort, Type |
listContainers[n].Labels | object | Key-value label pairs applied to the container |
status | string | success |
resource | string | container |
operation | string | list |
Error Port
On failure the error port receives an object with errorCode (string), message (string), resource, and operation. Always connect the error port to a notification or retry node.
Sample Output
{
"listContainers": [
{
"Id": "a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
"Names": ["/api-service"],
"Image": "myapp:v2.1.0",
"ImageID": "sha256:abc123...",
"Command": "node server.js",
"Status": "Up 3 hours",
"State": "running",
"Created": 1704067200,
"Ports": [
{ "PrivatePort": 8080, "PublicPort": 3000, "Type": "tcp", "IP": "0.0.0.0" }
],
"Labels": {
"com.bizfirst.env": "production",
"com.bizfirst.service": "api"
},
"NetworkSettings": {
"Networks": {
"bridge": { "IPAddress": "172.17.0.2" }
}
}
},
{
"Id": "b2c3d4e5f6a71234567890abcdef1234567890abcdef1234567890abcdef1234",
"Names": ["/worker-job-42"],
"Image": "myworker:latest",
"Command": "python worker.py",
"Status": "Exited (0) 2 hours ago",
"State": "exited",
"Created": 1704060000,
"Ports": [],
"Labels": { "com.bizfirst.env": "production" }
}
],
"status": "success",
"resource": "container",
"operation": "list"
}
Expression Reference
| Expression | Returns |
{{ $output.listContainers.length }} | Total number of containers returned |
{{ $output.listContainers[0].Id }} | ID of the first container in the list |
{{ $output.listContainers[0].State }} | State of the first container: running, exited, etc. |
{{ $output.listContainers[0].Names[0] }} | Name of the first container (e.g. /api-service) |
{{ $output.listContainers[0].Image }} | Image tag of the first container |
{{ $output.listContainers[0].Ports[0].PublicPort }} | First exposed public port number |
{{ $output.listContainers[0].Labels['com.bizfirst.env'] }} | Value of a specific container label |
{{ $output.listContainers.filter(c => c.State === 'exited') }} | Array of exited containers only |
Node Policies & GuardRails
| Policy | Detail |
| No remote TCP without TLS | Using connectionType: tcp against a remote host is blocked in production GuardRail profiles. Use tcptls. |
| Credentials Manager for TLS paths | Set tlsCertPath via {{ $credentials.dockerTlsCertPath }}. Hard-coded paths are flagged by static analysis. |
| Always wire the error port | If the Docker daemon is unreachable, the success port will not fire. An unhandled error port causes silent workflow failure. |
| Downstream filtering only | This operation returns all containers. Apply state and name filters in a subsequent Function or If Condition node — do not rely on Docker API filter parameters for security decisions. |
| Read-only operation | container/list is non-destructive. It can be safely polled on a schedule without side effects. |
Examples
Example 1: Alert on exited containers
A scheduled workflow runs every 5 minutes, lists all containers, filters for those in the exited state, and sends a Slack alert for each one found.
// Function node downstream of container/list
const exited = $input.listContainers.filter(c => c.State === 'exited');
if (exited.length === 0) return { alert: false };
return {
alert: true,
count: exited.length,
containers: exited.map(c => ({
name: c.Names[0],
image: c.Image,
status: c.Status
}))
};
Example 2: Deployment verification
After a blue-green deploy, list containers and confirm the new image tag is running before removing the old container.
// If Condition node checks:
// $output.listContainers.some(c => c.Image === 'myapp:v2.2.0' && c.State === 'running')
// → true: proceed to remove old container
// → false: trigger rollback workflow
Example 3: Container inventory report
Build a daily inventory CSV by listing all containers and extracting key fields into a data mapping node.
// Data Mapping node expression for each row:
{
"id": "{{ $output.listContainers[$index].Id.substring(0, 12) }}",
"name": "{{ $output.listContainers[$index].Names[0] }}",
"image": "{{ $output.listContainers[$index].Image }}",
"state": "{{ $output.listContainers[$index].State }}",
"created": "{{ new Date($output.listContainers[$index].Created * 1000).toISOString() }}"
}