No description
Find a file
2024-01-13 21:32:28 +05:00
.github/workflows update 2024-01-13 21:31:01 +05:00
.dockerignore update 2024-01-13 21:31:01 +05:00
.editorconfig Add editorconfig 2018-11-27 03:05:37 +01:00
.gitignore ignore dot output 2023-06-16 21:46:59 -04:00
docker-compose.yml update 2024-01-13 21:31:01 +05:00
docker-network-graph.py update 2024-01-13 21:31:01 +05:00
Dockerfile utilities build, run, and consistent name scheme 2023-06-16 21:06:24 -04:00
example.png update 2024-01-13 21:31:01 +05:00
LICENSE update 2024-01-13 21:31:01 +05:00
Pipfile update docker, clamp 3.6 <= python < 4 2023-06-16 21:46:17 -04:00
Pipfile.lock update docker, clamp 3.6 <= python < 4 2023-06-16 21:46:17 -04:00
README.md Update README.md 2024-01-13 21:32:28 +05:00

Docker Network Graph

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

This repository fork e-dant/docker-network-graph Changes:

  • Improved design
  • Added the ability to generate url
  • Added display of connections with the host

Example

example graph

Usage

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

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 [not supported by container]
  -u, --url          Generate link for GraphvizOnline

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 -u

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

Running local

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.

This will just generate and output the graph in the [DOT Language][dot]. You can then paste that code into [GraphvizOnline][gvonline] 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.

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 docker-compose.yml up -d.

Credit

dot lang gvonline