Skip to main content
statuslinesSource-backedReview first Safety Privacy
Docker logo

Claude Code Docker Statusline - Container Health Monitoring

Docker statusline configuration for Claude Code CLI. Features real-time health monitoring, color-coded indicators, and container tracking. Production-ready.

by JSONbored·added 2025-10-19·
HarnessClaude Code
Language:bash
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://docs.docker.com/reference/cli/docker/container/stats/, https://github.com/JSONbored/awesome-claude/blob/main/content/statuslines/docker-health-statusline.mdx
Brand
Docker
Brand domain
docker.com
Brand asset source
brandfetch
Safety notes
Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.
Privacy notes
Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-19

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Config edit

Copy-ready — paste the snippet to get started.

Install command

Not provided

Config snippet

Provided

Copy snippet

Provided

Prerequisites

6 to clear

Platforms

1 listed

Difficulty

2/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Prerequisite readiness

Prerequisite readiness

6 prerequisites to line up before setup.

0/6 ready
Install & runtime2Permissions & scopes1Network & hosting2General1

Safety & privacy surface

Safety & privacy surface

1 safety and 1 privacy notes across 1 risk area. Review closely: credentials & tokens.

1 area
  • SafetyCredentials & tokensRuns as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.
  • PrivacyCredentials & tokensReads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.

Safety notes

  • Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.

Privacy notes

  • Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.

Prerequisites

  • Docker Engine installed and running (Docker 17.05+ recommended for health check support)
  • Bash shell available (bash 4.0+ recommended for arithmetic operations and string manipulation)
  • Docker CLI accessible in PATH (docker command must be available)
  • User permissions to run docker commands (user must be in docker group on Linux or have Docker Desktop access on macOS/Windows)
  • Terminal with ANSI color code support (256-color mode recommended for color-coded health indicators)
  • Docker daemon socket accessible (DOCKER_HOST environment variable or default socket at /var/run/docker.sock)

Schema details

Install type
config
Reading time
1 min
Difficulty score
2
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://code.claude.com/docs/en/statusline
Runtime and command metadata
Script language
bash
Script body
#!/bin/bash

# Docker Health Statusline
# Real-time container health monitoring for Claude Code CLI

# Get running containers count
running=$(docker ps -q 2>/dev/null | wc -l | tr -d ' ')

# Get total containers
total=$(docker ps -a -q 2>/dev/null | wc -l | tr -d ' ')

# Get unhealthy containers
unhealthy=$(docker ps --filter health=unhealthy -q 2>/dev/null | wc -l | tr -d ' ')

# Color codes
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Status indicator
if [ "$unhealthy" -gt 0 ]; then
    status="${RED}●${NC}"
elif [ "$running" -eq 0 ]; then
    status="${YELLOW}○${NC}"
else
    status="${GREEN}●${NC}"
fi

# Display statusline
echo -e "${BLUE}🐳${NC} ${status} ${running}/${total}"
Full copyable content
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/docker-health-statusline.sh",
    "refreshInterval": 2000
  }
}

About this resource

Features

  • Real-time container count display (running/total)
  • Color-coded health status indicators (green=healthy, yellow=stopped, red=unhealthy)
  • Docker whale emoji for visual identification
  • Lightweight bash implementation with minimal overhead
  • Automatic unhealthy container detection
  • Configurable refresh interval (default 2000ms)
  • Container name truncation for long names
  • Docker Compose project detection and display

Use Cases

  • Monitoring Docker container health during development
  • Quick visual confirmation of running containers
  • DevOps workflows requiring constant container status awareness
  • Multi-container application development with health checks
  • CI/CD pipeline monitoring for containerized services
  • Debugging container startup issues with real-time status feedback

Requirements

  • Docker Engine installed and running (Docker 17.05+ recommended for health check support)
  • Bash shell available (bash 4.0+ recommended for arithmetic operations and string manipulation)
  • Docker CLI accessible in PATH (docker command must be available)
  • User permissions to run docker commands (user must be in docker group on Linux or have Docker Desktop access on macOS/Windows)
  • Terminal with ANSI color code support (256-color mode recommended for color-coded health indicators)
  • Docker daemon socket accessible (DOCKER_HOST environment variable or default socket at /var/run/docker.sock)

Configuration

{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/docker-health-statusline.sh",
    "refreshInterval": 2000
  }
}

Examples

Enhanced Docker Health Statusline with Container Names

Extended version displaying unhealthy container names for quick identification

#!/bin/bash

# Enhanced Docker Health Statusline with Container Names

running=$(docker ps -q 2>/dev/null | wc -l | tr -d ' ')
total=$(docker ps -a -q 2>/dev/null | wc -l | tr -d ' ')
unhealthy=$(docker ps --filter health=unhealthy -q 2>/dev/null | wc -l | tr -d ' ')

GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'

if [ "$unhealthy" -gt 0 ]; then
    status="${RED}●${NC}"
    unhealthy_names=$(docker ps --filter health=unhealthy --format '{{.Names}}' 2>/dev/null | tr '\n' ',' | sed 's/,$//')
    if [ -n "$unhealthy_names" ]; then
        echo -e "${BLUE}🐳${NC} ${status} ${running}/${total} (${RED}${unhealthy_names}${NC})"
    else
        echo -e "${BLUE}🐳${NC} ${status} ${running}/${total}"
    fi
elif [ "$running" -eq 0 ]; then
    status="${YELLOW}○${NC}"
    echo -e "${BLUE}🐳${NC} ${status} ${running}/${total}"
else
    status="${GREEN}●${NC}"
    echo -e "${BLUE}🐳${NC} ${status} ${running}/${total}"
fi

Docker Health Statusline with Restart Count

Version showing container restart counts for monitoring stability

#!/bin/bash

# Docker Health Statusline with Restart Count

running=$(docker ps -q 2>/dev/null | wc -l | tr -d ' ')
total=$(docker ps -a -q 2>/dev/null | wc -l | tr -d ' ')
unhealthy=$(docker ps --filter health=unhealthy -q 2>/dev/null | wc -l | tr -d ' ')

# Get containers with restart count > 0
restarting=$(docker ps -a --filter 'restart-count=1' --format '{{.Names}}' 2>/dev/null | wc -l | tr -d ' ')

GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'

if [ "$unhealthy" -gt 0 ]; then
    status="${RED}●${NC}"
elif [ "$restarting" -gt 0 ]; then
    status="${YELLOW}⚠${NC}"
elif [ "$running" -eq 0 ]; then
    status="${YELLOW}○${NC}"
else
    status="${GREEN}●${NC}"
fi

if [ "$restarting" -gt 0 ]; then
    echo -e "${BLUE}🐳${NC} ${status} ${running}/${total} (${restarting} restarted)"
else
    echo -e "${BLUE}🐳${NC} ${status} ${running}/${total}"
fi

Docker Health Statusline Installation Example

Complete setup script with Docker daemon verification and permissions check

#!/bin/bash
# Installation script for Docker Health Statusline

# Check if Docker is installed
if ! command -v docker &> /dev/null; then
    echo "Error: Docker is not installed or not in PATH"
    echo "Install Docker: https://docs.docker.com/get-docker/"
    exit 1
fi

# Check if Docker daemon is running
if ! docker ps &> /dev/null; then
    echo "Error: Docker daemon is not running"
    echo "Start Docker daemon and try again"
    exit 1
fi

# Check user permissions
if ! docker ps &> /dev/null; then
    echo "Warning: User may not have Docker permissions"
    echo "On Linux, add user to docker group: sudo usermod -aG docker $USER"
    echo "Then log out and log back in"
fi

mkdir -p .claude/statuslines

cat > .claude/statuslines/docker-health-statusline.sh << 'SCRIPT_EOF'
#!/bin/bash

# Docker Health Statusline
# Real-time container health monitoring for Claude Code CLI

running=$(docker ps -q 2>/dev/null | wc -l | tr -d ' ')
total=$(docker ps -a -q 2>/dev/null | wc -l | tr -d ' ')
unhealthy=$(docker ps --filter health=unhealthy -q 2>/dev/null | wc -l | tr -d ' ')

GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'

if [ "$unhealthy" -gt 0 ]; then
    status="${RED}●${NC}"
elif [ "$running" -eq 0 ]; then
    status="${YELLOW}○${NC}"
else
    status="${GREEN}●${NC}"
fi

echo -e "${BLUE}🐳${NC} ${status} ${running}/${total}"
SCRIPT_EOF

chmod +x .claude/statuslines/docker-health-statusline.sh

# Add to settings.json
if [ ! -f .claude/settings.json ]; then
    echo '{"statusLine":{"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/docker-health-statusline.sh","refreshInterval":2000}}' > .claude/settings.json
else
    jq '.statusLine = {"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/docker-health-statusline.sh","refreshInterval":2000}' .claude/settings.json > .claude/settings.json.tmp
    mv .claude/settings.json.tmp .claude/settings.json
fi

echo "Docker Health Statusline installed successfully!"
echo "Test with: docker ps"

Troubleshooting

Statusline shows 0/0 containers even when containers are running

Verify Docker daemon is running with 'docker ps'. Check user has permissions to access Docker socket. On Linux, add user to docker group with 'sudo usermod -aG docker $USER' and restart terminal. On macOS/Windows, ensure Docker Desktop is running. Verify DOCKER_HOST environment variable if using remote Docker daemon.

Colors not displaying correctly in statusline output

Ensure terminal supports ANSI color codes. Set TERM=xterm-256color in shell profile (~/.bashrc or ~/.zshrc). Verify colorScheme setting in statusline.json matches terminal capabilities. Test with: echo -e '\033[0;32mGREEN\033[0m'. If colors still don't work, terminal may not support ANSI codes.

Statusline causing performance lag or high CPU usage

Increase refreshInterval to 3000-5000ms in configuration. Reduce docker ps query frequency. Consider caching container count between refresh cycles for better performance. Use docker ps -q (quiet mode) to reduce output parsing overhead. Monitor Docker daemon performance with 'docker stats'.

Health check status not updating or always showing healthy

Confirm containers have HEALTHCHECK defined in Dockerfile or docker-compose.yml. Verify docker version supports health checks (17.05+). Run 'docker inspect CONTAINER' to check health configuration. Check health check interval and timeout settings. Verify health check command is working: docker exec CONTAINER health-check-command.

Permission denied errors when running docker commands

On Linux: Add user to docker group: sudo usermod -aG docker $USER, then log out and log back in. Verify group membership: groups $USER. Check Docker socket permissions: ls -l /var/run/docker.sock. On macOS/Windows: Ensure Docker Desktop is running and user has proper permissions. Check Docker Desktop settings for user access.

Unhealthy containers not being detected by statusline

Verify health check filter syntax: docker ps --filter health=unhealthy. Check if containers actually have health checks configured: docker inspect CONTAINER | jq '.[0].State.Health'. Ensure Docker version supports health checks (17.05+). Verify health check command is failing as expected. Check health check logs: docker inspect CONTAINER | jq '.[0].State.Health.Log'.

Docker daemon connection errors or socket not found

Verify Docker daemon is running: systemctl status docker (Linux) or check Docker Desktop status (macOS/Windows). Check DOCKER_HOST environment variable: echo $DOCKER_HOST. Default socket location: /var/run/docker.sock (Linux) or ~/.docker/run/docker.sock (macOS). Verify socket exists: ls -l /var/run/docker.sock. Restart Docker daemon if needed.

Statusline showing incorrect container counts

Verify docker ps commands are working: docker ps -q | wc -l. Check for stopped containers: docker ps -a -q | wc -l. Ensure script is using correct flags: -q for quiet mode, -a for all containers. Verify wc and tr commands are available: which wc tr. Check for hidden characters in output: docker ps -q | od -c.

Source citations

Add this badge to your README

Show that Claude Code Docker Statusline - Container Health Monitoring is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/statuslines/docker-health-statusline.svg)](https://heyclau.de/entry/statuslines/docker-health-statusline)

How it compares

Claude Code Docker Statusline - Container Health Monitoring side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

1 trust signal differ across this comparison (Submitter).

Field

Docker statusline configuration for Claude Code CLI. Features real-time health monitoring, color-coded indicators, and container tracking. Production-ready.

Open dossier

A Claude Code statusline that reads the session JSON on stdin and splits total_duration_ms into API processing time versus network/waiting time (total minus API).

Open dossier

Real-time burn rate monitor showing cost per minute, tokens per minute, and projected daily spend to prevent budget overruns during Claude Code sessions.

Open dossier

Claude Code statusline that estimates context pressure from local session token counts and a configurable context limit, then prints a compact risk tier.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
SubmitterDiffersMkDev11
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
BrandDocker logoDocker
Categorystatuslinesstatuslinesstatuslinesstatuslines
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredMkDev11
Added2025-10-192025-10-252025-10-252026-06-04
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesRuns as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.Configured as a command-type statusline, so the script runs automatically on every status update. The Examples "Installation" script writes .claude/statuslines/api-latency-breakdown.sh and edits .claude/settings.json, and runs brew/apt-get/yum to install bc.Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.Context percentage is only as accurate as the configured limit and the usage fields available in the statusline input. Use the warning as a cue to summarize or checkpoint work before context pressure affects reasoning quality. Do not treat a low percentage as proof that all relevant files, instructions, or tool results are still in scope.
Privacy notesReads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.The Examples "Enhanced P95" variant appends every measured network time to /tmp/claude_latency_history.txt, leaving session timing data on disk until manually cleared.Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.The script reads local session counters and does not inspect prompt text, files, or transcript contents. Token counts and configured limits can still reveal workload size in screenshots or shared terminal logs. Teams should avoid placing customer names or project identifiers in shell variables that appear in debugging output.
Prerequisites
  • Docker Engine installed and running (Docker 17.05+ recommended for health check support)
  • Bash shell available (bash 4.0+ recommended for arithmetic operations and string manipulation)
  • Docker CLI accessible in PATH (docker command must be available)
  • User permissions to run docker commands (user must be in docker group on Linux or have Docker Desktop access on macOS/Windows)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • bc calculator (bc 1.07+ recommended for floating point calculations, optional - script falls back to integer math)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • bc calculator (bc 1.07+ required for floating point calculations - script will fail without bc)
  • Claude Code statusline support with local JSON input.
  • jq available for reading session usage fields.
  • Optional CLAUDE_CONTEXT_LIMIT set to the model or workflow limit your team wants to track.
Install
Config
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/docker-health-statusline.sh",
    "refreshInterval": 2000
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/api-latency-breakdown.sh"
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/burn-rate-monitor.sh",
    "refreshInterval": 500
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/context-pressure-statusline.sh"
  }
}
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.