No description
Find a file
dependabot[bot] 1e4f435f1c
Bump docker/metadata-action from 3 to 4
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 3 to 4.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](https://github.com/docker/metadata-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-05 14:14:18 +00: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
.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.