No description
Find a file
2018-11-27 03:05:37 +01:00
.editorconfig Add editorconfig 2018-11-27 03:05:37 +01:00
.gitignore Use fdp with splines and random network colours 2018-08-31 06:21:48 +02:00
docker-net-graph.py Fix error on containerless networks 2018-11-08 14:59:01 +01:00
Dockerfile Improve build speed by making intermediaries reusable 2018-11-08 15:03:53 +01:00
example.png Add example graph 2018-08-31 15:31:13 +02:00
LICENSE Fixes #1 Add license 2018-08-31 20:29:22 +03:00
Pipfile Add command line parameters 2018-08-31 04:53:54 +02:00
Pipfile.lock Add command line parameters 2018-08-31 04:53:54 +02:00
README.md Use ENTRYPOINT instead of CMD to allow running the container with custom args 2018-08-31 21:51:03 +02:00
requirements-dev.txt Initial commit 2016-09-30 00:48:22 +03:00

Docker Network Graph

Visualize the relationship between Docker networks and containers as a neat graphviz graph.

Example

example graph

Usage

usage: docker-net-graph.py [-h] [-v] [-o OUT]

Generate docker network graph.

optional arguments:
  -h, --help         show this help message and exit
  -v, --verbose      Verbose output
  -o OUT, --out OUT  Write output to file

In most cases what you want to run are the following couple commands:

git clone https://github.com/LeoVerto/docker-network-graph-poc.git
cd docker-network-graph-poc
pipenv install
pipenv run python docker-net-graph.py -o output.gv

This will end up generating a .pdf file containing the graph.

Running inside docker

If you want to generate a graph for a remote system you can also easily run this script inside a pre-built docker container:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock leoverto/docker-network-graph

This will just generate and output the graph. You can then run fdp -Tpdf -o out.pdfor fdp -Tpng -o out.png on a system with graphviz installed, paste the previous output there, press enter and finally CTRL+C to generate the file.

Alternatively, you can use this website for an online version of Graphviz. The recommended render engine is fdp.

For more advanced use cases you can append arguments to the docker run command as if you were running it in a local shell.