Git Product home page Git Product logo

docker-debug's Introduction

Docker-debug

Build Status Go Report Card

English简体中文

Overview

docker-debug is an troubleshooting running docker container, which allows you to run a new container in running docker for debugging purpose. The new container will join the pid, network, user, filesystem and ipc namespaces of the target container, so you can use arbitrary trouble-shooting tools without pre-installing them in your production container image.

Demo

asciicast

Quick Start

Install the docker-debug cli

mac brew

brew tap zeromake/docker-debug
brew install docker-debug

download binary file

# MacOS
curl -Lo docker-debug https://github.com/zeromake/docker-debug/releases/download/0.6.2/docker-debug-darwin-amd64

# Linux
curl -Lo docker-debug https://github.com/zeromake/docker-debug/releases/download/0.6.2/docker-debug-linux-amd64

chmod +x ./docker-debug
sudo mv docker-debug /usr/local/bin/

# Windows
curl -Lo docker-debug.exe https://github.com/zeromake/docker-debug/releases/download/0.6.2/docker-debug-windows-amd64.exe

download the latest binary from the release page and add it to your PATH.

Try it out!

# docker-debug [OPTIONS] CONTAINER COMMAND [ARG...] [flags]
docker-debug CONTAINER COMMAND

# More flags
docker-debug --help

# info
docker-debug info

Build from source

Clone this repo and:

go build -o docker-debug ./cmd/docker-debug
mv docker-debug /usr/local/bin

Default image

docker-debug uses nicolaka/netshoot as the default image to run debug container. You can override the default image with cli flag, or even better, with config file ~/.docker-debug/config.toml

version = "0.6.1"
image = "nicolaka/netshoot:latest"
mount_dir = "/mnt/container"
timeout = 10000000000
config_default = "default"

[config]
  [config.default]
    host = "unix:///var/run/docker.sock"
    tls = false
    cert_dir = ""
    cert_password = ""

Todo

  • support windows7(Docker Toolbox)
  • support windows10
  • refactoring code
  • add testing
  • add changelog
  • add README_CN.md
  • add brew package
  • docker-debug version manage config file
  • cli command set mount target container filesystem
  • mount volume filesystem
  • docker connection config on cli command
  • -v cli args support
  • docker-debug signal handle smooth exit
  • cli command document on readme
  • config file document on readme
  • add http api and web shell

Details

  1. find image docker is has, not has pull the image.
  2. find container name is has, not has return error.
  3. from customize image runs a new container in the container's namespaces (ipc, pid, network, etc, filesystem) with the STDIN stay open.
  4. create and run a exec on new container.
  5. Debug in the debug container.
  6. then waits for the debug container to exit and do the cleanup.

Reference & Thank

  1. kubectl-debug: docker-debug inspiration is from to this a kubectl debug tool.
  2. Docker核心技术与实现原理: docker-debug filesystem is from the blog.
  3. docker-engine-api-doc: docker engine api document.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

docker-debug's People

Contributors

zeromake avatar monkeywithacupcake avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.