Portal Community

When to Use

  Docker sends SIGTERM first and gives the container's process up to 10 seconds (default) to exit gracefully. After the timeout, SIGKILL is sent. Applications that need longer shutdown windows (e.g. draining active HTTP connections) should set a longer timeoutSeconds value.

Configuration

Connection Fields

FieldTypeDefaultDescription
dockerHoststringunix:///var/run/docker.sockDocker socket path or TCP endpoint
connectionTypestringunixsocketunixsocket | tcp | tcptls
tlsCertPathstringTLS certificate directory. Required for tcptls. optional
timeoutSecondsint30Grace period before SIGKILL. Increase for applications with long shutdown sequences. optional

Operation Fields

FieldTypeRequiredDescription
resourcestringrequiredMust be container
operationstringrequiredMust be stop
ContainerIdstringrequiredContainer ID (full or short) or container name

Sample Configuration

{
  "resource": "container",
  "operation": "stop",
  "ContainerId": "api-service-green",
  "connection": {
    "dockerHost": "unix:///var/run/docker.sock",
    "connectionType": "unixsocket",
    "timeoutSeconds": 30
  }
}

Validation Errors

Error CodeTriggerResolution
MISSING_INPUTContainerId is emptyProvide the container name or ID.
NOT_FOUNDContainer does not existContainer may already have been removed. Handle NOT_FOUND as non-fatal in cleanup workflows.
DOCKER_API_ERRORDaemon error during stopCheck daemon logs. Very rare — typically a container with a corrupted state.

Output

Success Port

FieldTypeDescription
containerIdstringID of the container that was stopped
statusstringsuccess
resourcestringcontainer
operationstringstop

Error Port

On failure, the error port receives errorCode, message, resource, and operation. NOT_FOUND should be treated as acceptable in cleanup and rollback workflows where the container may or may not be running.

Sample Output

{
  "containerId": "a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890",
  "status": "success",
  "resource": "container",
  "operation": "stop"
}

Expression Reference

ExpressionReturns
{{ $output.containerId }}ID of the stopped container — pass to container/remove downstream
{{ $output.status }}success when stop completed

Node Policies & GuardRails

PolicyDetail
Stop before removecontainer/remove will fail with CONFLICT on a running container. Always place container/stop before container/remove in cleanup workflows.
Adjust timeout for graceful appsApplications that handle SIGTERM for connection draining need a longer timeout. Default is 10 seconds Docker-side; set timeoutSeconds in node config to accommodate your application's shutdown sequence.
No remote TCP without TLSUse tcptls for remote hosts.
Handle NOT_FOUND gracefullyIn cleanup and rollback pipelines, a missing container is an acceptable outcome. Route NOT_FOUND to a no-op branch rather than an alert.
Always wire the error portDaemon downtime will cause stop to fail. The error port must be connected to a fallback handler.

Examples

Example 1: Stop-then-remove cleanup

// Node 1: container/stop
{ "resource": "container", "operation": "stop", "ContainerId": "old-job-container" }

// Node 2: container/remove (uses same containerId)
{ "resource": "container", "operation": "remove", "ContainerId": "{{ $nodes.stopContainer.output.containerId }}" }

Example 2: Blue-green cutover — stop green after blue is healthy

// After container/exec health check passes on blue:
{
  "resource": "container",
  "operation": "stop",
  "ContainerId": "api-service-green"
}
// Then remove green:
{ "resource": "container", "operation": "remove", "ContainerId": "api-service-green" }

Example 3: Graceful shutdown for long-lived services

{
  "resource": "container",
  "operation": "stop",
  "ContainerId": "websocket-server",
  "connection": {
    "dockerHost": "unix:///var/run/docker.sock",
    "connectionType": "unixsocket",
    "timeoutSeconds": 60
  }
}
// 60-second grace period allows WebSocket connections to drain cleanly