No description
Find a file
dependabot[bot] d2bab00c5b
Bump actions/cache from 2 to 3
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 14:13:27 +00:00
.github Bump actions/cache from 2 to 3 2022-03-21 14:13:27 +00:00
test Fix KeyError when networks with no gateway exist 2020-07-01 15:46:24 +02: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-net-graph.py Fix KeyError when networks with no gateway exist 2020-07-01 15:46:24 +02: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 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 Show interface aliases above IPs 2020-06-05 01:01:30 +02: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]

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/LeoVerto/docker-network-graph.git
cd docker-network-graph
pipenv install
pipenv run python docker-net-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 leoverto/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.