Skip to main content

🐳 Docker Lens

Docker Lens is a lightweight, developer-friendly CLI tool for debugging running Docker containers.

It lets you instantly attach a fully-featured debug container to any running container — sharing network, PID, and filesystem namespaces — similar to docker debug, but open-source and pip-installable.

Think of it as:
kubectl debug for Docker containers 🔍

Demo{ width=400px }


✨ Features

  • 🔗 Attach a debug container to any running container
  • 🧠 Shares network, PID, and volumes
  • 🖥️ Fully interactive TTY
  • 🧹 Debug container is removed automatically on exit
  • 📦 Auto-pull debug images if missing
  • ⚙️ Configurable default debug image (profiles or custom)
  • 🐍 Written in Python, installable via pip

📦 Installation

python3 -m venv venv
source venv/bin/activate
pip install docker-lens

Requirements

  • Python 3.10+
  • Docker installed and running
  • Access to Docker socket (/var/run/docker.sock)

🚀 Usage

List containers

docker-lens

Equivalent to:

docker ps

Debug a running container

docker-lens debug <container_id_or_name>

Example:

docker-lens debug web-api

Specify debug image or shell

docker-lens debug web-api --image ubuntu:latest --shell /bin/bash

Change the default debug image

Use any custom image:

docker-lens set image jonlabelle/network-tools

Or use one of the pre-defined debug image profiles:

docker-lens set image network

🧰 Debug Image Profiles

Profile Usage Image
minimal common system and networking essentials. kavehmoradian/docker-lens:minimal
network Focused on network debugging and analysis. kavehmoradian/docker-lens:network
process Focused on process, system, and application debugging. kavehmoradian/docker-lens:process
full Includes everything from both network and process. kavehmoradian/docker-lens:full

⚙️ Configuration

Config file location:

~/.config/docker-lens/config.yaml

Example:

default_image: kavehmoradian/docker-lens:minimal

🔐 Permissions

If you see:

Permission denied while connecting to Docker socket.

Fix it:

sudo usermod -aG docker $USER
newgrp docker

Metadata

Release files for docker-lens 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docker-lens 0.1.1
File Size Uploaded
docker_lens-0.1.1.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docker-lens 0.1.1
File Interpreter ABI Platform
docker_lens-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.9 kB

Release files / docker_lens-0.1.1.tar.gz

Download URL docker_lens-0.1.1.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f108674fa6a8645cefbeb3f606853fe86b4ee07492ee506109eddd1018221374
BLAKE2b-256 checksum
How to use checksums
82d6e68c54dd17fd37017486a24f5fabacf37297cca9b47fdb72a9f86032c7fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / docker_lens-0.1.1-py3-none-any.whl

Download URL docker_lens-0.1.1-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f15f0ae76697f11200acd0e13f311da45fd58afb3adb9424db4740e7c69de375
BLAKE2b-256 checksum
How to use checksums
c5c425bbbcc1f4e4fe5283967d9d39db23d1c6b77ab118160f8ac5bf88c972b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page