Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Inspector

Docker Inspector is a professional terminal application for inspecting and monitoring a local Docker environment on Windows and Linux. It uses the official Docker Python SDK for Docker Engine API communication and Rich for clean tables, panels, prompts, and live resource views.

The tool is read-only by default. Operations that remove Docker resources ask for confirmation unless you explicitly pass --yes.

Features

  • Containers: list running and stopped containers, inspect full details, view status, ports, IPs, restart policy, mounts, and networks.
  • Container actions: start, stop, restart, pause, unpause, remove, and open an interactive shell.
  • Images: list images with repository, tag, size, creation date, parent image, container usage count, history, and layers.
  • Volumes: list volume metadata and identify containers using each volume before removal.
  • Networks: list network driver, scope, subnet, gateway, connected containers, internal status, and IPv6 status.
  • Logs: tail, follow, timestamps, keyword filtering, severity filtering, time ranges, and text export.
  • Stats: live CPU, memory, network, block I/O, process count, uptime, sorting, refresh intervals, and warning thresholds.
  • JSON export: containers, images, volumes, networks, resources, and full environment reports with host metadata.
  • Clear errors for missing Docker, daemon connection failures, permissions, timeouts, missing resources, unsupported API versions, and export failures.

Terminal Examples

Docker Inspector
Containers: 8 total, 4 running
Images: 21
Volumes: 12
Networks: 5
ID           Name      Image          Status     CPU      Memory
abc123def456 api       my-api:latest  RUNNING    12.30%   224.4 MiB

Installation

Python 3.11 or newer is required.

cd docker-inspector
python -m venv .venv

Windows PowerShell:

.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt

Linux:

source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt

Docker Requirements

Docker must be installed and the daemon must be running.

On Windows, start Docker Desktop before using the tool. If you use WSL-backed Docker Desktop, run the command in an environment where the Docker socket is available.

On Linux, your user usually needs permission to access the Docker socket:

sudo usermod -aG docker "$USER"

Log out and back in after changing group membership. You can also run with elevated permissions, but Docker Inspector does not require administrator access by design.

Usage

Running without arguments opens the interactive menu:

python docker_inspector.py

Common commands:

python docker_inspector.py dashboard
python docker_inspector.py containers
python docker_inspector.py containers --all
python docker_inspector.py inspect-container web
python docker_inspector.py logs web --tail 200
python docker_inspector.py logs web --follow --timestamps
python docker_inspector.py images
python docker_inspector.py volumes
python docker_inspector.py networks
python docker_inspector.py stats --refresh 2 --sort memory
python docker_inspector.py export containers
python docker_inspector.py export full

If installed as a package, use the console script:

docker-inspector dashboard

Command Reference

Containers:

python docker_inspector.py containers --all
python docker_inspector.py containers --running
python docker_inspector.py inspect-container <container>
python docker_inspector.py container-action <container> start
python docker_inspector.py container-action <container> stop
python docker_inspector.py container-action <container> restart
python docker_inspector.py container-action <container> pause
python docker_inspector.py container-action <container> unpause
python docker_inspector.py container-action <container> remove
python docker_inspector.py shell <container>

Images:

python docker_inspector.py images
python docker_inspector.py inspect-image <image>
python docker_inspector.py image-history <image>
python docker_inspector.py image-layers <image>
python docker_inspector.py remove-image <image>
python docker_inspector.py prune-images

Volumes:

python docker_inspector.py volumes
python docker_inspector.py inspect-volume <volume>
python docker_inspector.py remove-volume <volume>
python docker_inspector.py remove-volume <volume> --force-used
python docker_inspector.py prune-volumes

Networks:

python docker_inspector.py networks
python docker_inspector.py inspect-network <network>
python docker_inspector.py connect-network <network> <container>
python docker_inspector.py disconnect-network <network> <container>
python docker_inspector.py prune-networks

Logs:

python docker_inspector.py logs <container> --tail 500
python docker_inspector.py logs <container> --follow
python docker_inspector.py logs <container> --timestamps
python docker_inspector.py logs <container> --keyword timeout
python docker_inspector.py logs <container> --severity error
python docker_inspector.py logs <container> --since 2026-07-27T18:00:00 --until 2026-07-27T19:00:00
python docker_inspector.py logs <container> --export exports/web_logs.txt

Stats:

python docker_inspector.py stats
python docker_inspector.py stats --refresh 2
python docker_inspector.py stats --sort cpu
python docker_inspector.py stats --sort memory --cpu-threshold 70 --memory-threshold 75

Exports:

python docker_inspector.py export containers
python docker_inspector.py export images
python docker_inspector.py export volumes
python docker_inspector.py export networks
python docker_inspector.py export resources
python docker_inspector.py export full

Example filenames:

docker_containers_2026-07-27_190000.json
docker_resources_2026-07-27_190000.json
docker_full_report_2026-07-27_190000.json

Each JSON export includes:

{
  "export_timestamp": "2026-07-27T17:00:00+00:00",
  "docker_version": "27.0.0",
  "operating_system": "Windows-11-...",
  "hostname": "workstation",
  "resource": "containers",
  "data": []
}

Security Notes

Access to Docker is powerful. A user who can control Docker can often affect the host system through mounted files, privileged containers, and daemon APIs. Docker Inspector avoids hardcoded Docker configuration and uses read-only inspection by default, but actions such as remove, prune, connect, disconnect, and shell access modify or enter the Docker environment.

Review destructive prompts carefully. Use --yes only in trusted automation.

Troubleshooting

Docker not installed:

The Docker Python SDK is not installed.
Install dependencies with: pip install -r requirements.txt

Daemon not running:

Docker daemon is not running or is unreachable.
Start Docker Desktop or the Docker service, then try again.

Permission denied:

Permission denied while accessing Docker.
Verify Docker permissions for your user account.

Unsupported API version:

Unsupported Docker API version.
Upgrade Docker or set a compatible DOCKER_API_VERSION.

Development

cd docker-inspector
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pytest

On Windows:

cd docker-inspector
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pytest

The tests mock Docker API-shaped objects and do not require Docker to be running.

Project Structure

dockctl/
├── description.lua
├── docker_inspector.py
├── requirements.txt
├── pyproject.toml
└── README.md

About

A polished cross-platform terminal Docker inspector for monitoring containers, images, volumes, networks, logs, stats, and JSON exports.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages