Skip to content

malwarebo/dockstat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dockstat

Simple, powerful Docker container management CLI tool

Features

  • Fast container listing with enhanced information (Image, Ports, Status)
  • Responsive layout that adapts to your terminal width
  • Smart container matching - use partial IDs or names
  • Watch mode for real-time container monitoring
  • Essential container operations (start, stop, restart, kill, logs, exec)
  • Filter containers by name or status
  • Follow logs in real-time

Example output

$ dck show --all

ID            NAME                            IMAGE                      PORTS                     STATUS
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
2e8d111569..  nginx-web                       nginx:latest               8080->80/tcp, 8443->..    Up 5 days (healthy)
2e8d111567..  redis-cache                     redis:alpine               6379->6379/tcp            Up 5 days (healthy)
2e8d111562..  postgres-db                     postgres:14                5432->5432/tcp            Up 5 days (healthy)
2e8d111561..  api-backend                     myapp/api:latest           3000->3000/tcp            Up 3 days (healthy)
2e8d111560..  old-container                   ubuntu:20.04               -                         Exited (0) 2 days ago

Installation

Clone this repository and run:

# build
$ make

# install
$ sudo make install

Run the command dck from anywhere in the terminal.

Usage

List Containers

# List running containers
$ dck show

# List all containers (including stopped)
$ dck show --all
$ dck show -a

# Watch mode - auto-refresh every 2 seconds
$ dck show --watch
$ dck show -w

# Filter containers by name or status
$ dck show --filter nginx
$ dck show -f exited

Container Operations

All commands support partial ID or name matching! No need to copy/paste full container IDs.

# Kill a container (use partial ID or name)
$ dck kill nginx
$ dck kill 2e8d11

# Start a stopped container
$ dck run old-container
$ dck run 2e8d

# Restart a container
$ dck restart api-backend
$ dck restart 2e8d111

# View logs
$ dck log nginx
$ dck log postgres --tail 100          # Last 100 lines
$ dck log api-backend --follow         # Follow logs in real-time
$ dck log api-backend -f -n 50         # Follow with last 50 lines

# Execute interactive shell in container
$ dck exec nginx                       # Auto-detects bash or sh
$ dck exec postgres --shell /bin/bash  # Specify shell

Smart Container Matching

The tool automatically matches containers by:

  • Full or partial container ID
  • Full or partial container name (case-insensitive)

Examples:

dck kill 2e8d           # Matches container with ID starting with 2e8d
dck log nginx           # Matches container with "nginx" in the name
dck restart api         # Matches container with "api" in the name

If multiple containers match, you'll get a helpful list to choose from. If no exact match is found, you'll get suggestions for similar container names.

Command Reference

Usage:
  dck show [flags]              : list containers
    --all, -a                   : show all containers (including stopped)
    --watch, -w                 : watch mode - auto-refresh every 2s
    --filter, -f <pattern>      : filter by name or status

  dck kill <container>          : kill a running container
  dck log <container> [flags]   : show logs of a container
    --follow, -f                : follow log output
    --tail, -n <number>         : number of lines to show (default: all)

  dck run <container>           : start a stopped container
  dck restart <container>       : restart a container
  dck exec <container> [flags]  : execute interactive shell in container
    --shell, -s <shell>         : specify shell (default: auto-detect)

Note: <container> can be container ID (full or partial) or name (or partial name)

Development

Run Tests

# using go
$ go test -v ./...

# using make
$ make test

Build

# Build the binary
$ make

# Build and install
$ make install

Requirements

  • Go 1.23 or higher
  • Docker daemon running

About

Simple docker container status cli tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •