From 59ea5ea0b57ccaaaa87e827a61a44e04a198351d Mon Sep 17 00:00:00 2001 From: LeoVerto Date: Tue, 27 Nov 2018 07:37:31 +0100 Subject: [PATCH] Update and clarify README --- README.md | 29 +++++++++++++++++------------ docker-net-graph.py | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fb64812..046d8c7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ as a neat graphviz graph. ## Usage usage: docker-net-graph.py [-h] [-v] [-o OUT] - Generate docker network graph. + Visualize docker networks. optional arguments: -h, --help show this help message and exit @@ -19,12 +19,12 @@ as a neat graphviz graph. 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 + 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.gv + pipenv run python docker-net-graph.py -o output.svg -This will end up generating a .pdf file containing the graph. +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 @@ -32,13 +32,18 @@ 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.pdf`or `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. +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. -Alternatively, you can use [this website](https://dreampuf.github.io/GraphvizOnline/) 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. \ No newline at end of file +command as if you were running it in a local shell. + +[dot]: https://www.graphviz.org/doc/info/lang.html +[gvonline]: https://dreampuf.github.io/GraphvizOnline/ diff --git a/docker-net-graph.py b/docker-net-graph.py index df03f37..d439a9a 100755 --- a/docker-net-graph.py +++ b/docker-net-graph.py @@ -183,7 +183,7 @@ def graphviz_output_file(filename: str): if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Generate docker network graph.") + parser = argparse.ArgumentParser(description="Visualize docker networks.") parser.add_argument("-v", "--verbose", help="Verbose output", action="store_true") parser.add_argument("-o", "--out", help="Write output to file", type=graphviz_output_file) args = parser.parse_args()