dockerveth

package module
v0.0.0-...-c53a904 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 9 Imported by: 0

README

go-dockerveth

go-dockerveth is CLI tool that show which docker containers are attached to which veth interfaces.
This is inspired by micahculpepper/dockerveth.

Features

  • Doesn't need sudo
  • Doesn't need docker cli
  • Can be used in combination with other commands in plain text output

Requirements

  • Go 1.13.4 or higher

Support OS

  • Linux

Installation

$ git clone https://github.com/skanehira/go-dockerveth
$ cmd go-dockerveth/cmd/dockerveth
$ go install

Usage

$ dockerveth
+--------------+-------------+------------+---------------+------+
|  CONTAINER   |    VETH     |   NAMES    |     IMAGE     | CMD  |
+--------------+-------------+------------+---------------+------+
| ad448862880e | veth393c35f | vimgolf    | ruby          | bash |
| eadea1368853 | veth43f9468 | golang1.13 | golang:latest | bash |
+--------------+-------------+------------+---------------+------+

# If you use option `-p`, then print plain text
$ dockerveth -p
ad448862880e    veth393c35f     vimgolf         ruby            bash
eadea1368853    veth43f9468     golang1.13      golang:latest   bash

# help
$ dockerveth -h
Usage of dockerveth:
  -nocolor
        doesn't use header color
  -p    make plain text(default is make table)

If you want to capture packet from container, you cat do it following.

# fzf is fuzzy finder, you can install it from https://github.com/junegunn/fzf
# termshark is tui for wireshark, you can install if from https://github.com/gcla/termshark
sudo termshark -i $(dockerveth -p | fzf | awk "{print \$2}")

Author

skanehira

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyExecID = errors.New("empty exec id")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
}

Client wrap docker client

func NewClient

func NewClient() (*Client, error)

NewClient create new docker client

func (cli *Client) ContainerIflink(cid string) (string, error)

ContainerIflink get container iflink

func (*Client) Containers

func (cli *Client) Containers() ([]types.Container, error)

Containers get contianers

func (*Client) GetContainerInfo

func (cli *Client) GetContainerInfo() ([][]string, error)

GetContainerInfo get container info used by output

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL