Skip to main content

🛠️ Simple and interactive CLI for Docker container management

Project description

Docker Tool

🐳 Smart Docker container management with an elegant CLI.

Features

  • Smart Container Search: Find containers by ID, name, or partial match
  • Rich Output: Colorful tables and formatted output with rich
  • Intelligent Commands: Short commands that do what you expect
  • Docker Compose Support: Automatically detects and uses docker-compose

Installation

Prerequisites

  • Python 3.8+
  • Docker installed and running

Install

pip install docker-tool

Usage

Quick Commands

List Containers

# List running containers
dtool ps

# List all containers
dtool ps -a

Container Management

# Open shell (intelligent container search)
dtool shell nginx
dtool shell backend
dtool shell e5d  # Partial ID

# Execute commands
dtool exec nginx ls -la
dtool exec backend cat /etc/hosts

# View logs
dtool logs nginx
dtool logs backend -f

# Container lifecycle
dtool stop nginx
dtool start nginx
dtool restart backend
dtool rm nginx
dtool rm backend -f

Smart Container Search

The tool intelligently searches for containers:

  1. By ID: Matches container ID prefix

    dtool shell e5d4a2  # Matches container starting with e5d4a2
    
  2. By exact name: Matches full container name

    dtool shell my-nginx  # Matches container named "my-nginx"
    
  3. By partial name: Grep-like search

    dtool shell backend  # Matches "app-backend", "backend-api", etc.
    
  4. Interactive selection: When multiple matches found

    dtool shell app  # Shows menu if multiple containers contain "app"
    

Examples

Common Workflows

# Quick shell access
dtool shell backend

# Execute a command in a container
dtool exec frontend id

# Check logs of multiple services
dtool logs frontend
dtool logs backend

# Restart a service
dtool restart nginx

Advanced Usage

# Use specific shell
dtool shell alpine /bin/sh

# Force stop container
dtool stop stubborn-container --force

# Follow logs
dtool logs app -f

Project Structure

docker-wrapper/
├── requirements.txt     # Python dependencies
└── docker_tool/
    ├── __init__.py
    ├── cli.py           # Main CLI entry point
    ├── docker_client.py # Docker command wrapper
    ├── version.py       # Version information
    └── utils.py         # Utility functions

Why Docker Tool?

  • Shorter Commands: dtool shell nginx vs docker exec -it nginx /bin/bash
  • Smart Search: No need to remember full container IDs or names
  • Beautiful Output: Rich formatting makes information easy to read
  • Error Handling: Graceful fallbacks (e.g., sh when bash unavailable)

Contributing

Feel free to submit issues and enhancement requests!

License

MIT License - feel free to use in your projects!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docker_tool-1.0.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docker_tool-1.0.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file docker_tool-1.0.2.tar.gz.

File metadata

  • Download URL: docker_tool-1.0.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for docker_tool-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fa8fed1d4c8bb269c64ae29293a750e998e197e2dadfacb10f91673ca8f14e3f
MD5 cb511bc269d7ce585864d6eca5521dcc
BLAKE2b-256 70ebad08466aa744d496cb26f656a51c39f47cab1796d479d3bf930c79d9248a

See more details on using hashes here.

File details

Details for the file docker_tool-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: docker_tool-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for docker_tool-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c115decff6ffd08bb88393b84d39ba24ac99140cdde809910fd2e8bc5b3d9f0
MD5 995cf25c3cddb34743ef887cae8fc128
BLAKE2b-256 fa95c895848ccc1db821c8411d1aa04ab28218c1e9b120e2def1435c4f84256f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page