Update and clarify README
This commit is contained in:
parent
bd079656a6
commit
59ea5ea0b5
2 changed files with 18 additions and 13 deletions
27
README.md
27
README.md
|
@ -10,7 +10,7 @@ as a neat graphviz graph.
|
||||||
## Usage
|
## Usage
|
||||||
usage: docker-net-graph.py [-h] [-v] [-o OUT]
|
usage: docker-net-graph.py [-h] [-v] [-o OUT]
|
||||||
|
|
||||||
Generate docker network graph.
|
Visualize docker networks.
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-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:
|
In most cases what you want to run are the following couple commands:
|
||||||
|
|
||||||
git clone https://github.com/LeoVerto/docker-network-graph-poc.git
|
git clone https://github.com/LeoVerto/docker-network-graph.git
|
||||||
cd docker-network-graph-poc
|
cd docker-network-graph
|
||||||
pipenv install
|
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
|
## Running inside docker
|
||||||
If you want to generate a graph for a remote system you can also easily
|
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
|
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
|
This will just generate and output the graph in the [DOT Language][dot].
|
||||||
`fdp -Tpdf -o out.pdf`or `fdp -Tpng -o out.png` on a system with
|
You can then paste that code into [GraphvizOnline][gvonline]
|
||||||
graphviz installed, paste the previous output there, press enter
|
to render it. The recommended rendering engine is `fdp`.
|
||||||
and finally CTRL+C to generate the file.
|
|
||||||
|
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`
|
For more advanced use cases you can append arguments to the `docker run`
|
||||||
command as if you were running it in a local shell.
|
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/
|
||||||
|
|
|
@ -183,7 +183,7 @@ def graphviz_output_file(filename: str):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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("-v", "--verbose", help="Verbose output", action="store_true")
|
||||||
parser.add_argument("-o", "--out", help="Write output to file", type=graphviz_output_file)
|
parser.add_argument("-o", "--out", help="Write output to file", type=graphviz_output_file)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
Loading…
Reference in a new issue