No description
Find a file
2023-06-16 21:06:24 -04:00
.github Bump docker/metadata-action from 3 to 4 2022-05-05 14:14:18 +00:00
test Fix KeyError when networks with no gateway exist 2020-07-01 15:46:24 +02:00
tool utilities build, run, and consistent name scheme 2023-06-16 21:06:24 -04:00
.dockerignore Add GH Action for building and pushing docker image 2021-04-28 01:41:55 +02:00
.editorconfig Add editorconfig 2018-11-27 03:05:37 +01:00
.gitignore Update docker-py version, use MVC pattern, automatically select file type 2018-11-27 07:22:25 +01:00
docker-network-graph.py utilities build, run, and consistent name scheme 2023-06-16 21:06:24 -04:00
Dockerfile utilities build, run, and consistent name scheme 2023-06-16 21:06:24 -04:00
example.png Add example graph 2018-08-31 15:31:13 +02:00
LICENSE utilities build, run, and consistent name scheme 2023-06-16 21:06:24 -04:00
Pipfile Update requirements for Python 3.9 2021-04-28 01:39:35 +02:00
Pipfile.lock Bump urllib3 from 1.26.4 to 1.26.5 2021-06-02 04:40:07 +00:00
README.md utilities build, run, and consistent name scheme 2023-06-16 21:06:24 -04:00

Docker Network Graph

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

Example

example graph

Usage

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

Visualize docker networks.

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/e-dant/docker-network-graph.git
cd docker-network-graph
pipenv install
pipenv run python docker-network-graph.py -o output.svg

This will generate an .svg 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 e-dant/docker-network-graph

This will just generate and output the graph in the DOT Language. You can then paste that code into GraphvizOnline to render it. The recommended rendering engine is fdp.

Alternatively, if you prefer to render locally, you can run 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.

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

Development

If you'd like to contribute to this project, there is a sample docker-compose file using dummy containers in test.

You can deploy it using docker-compose -f test/docker-compose.yml up -d.