Fix KeyError when containers are attached to no or host network
Fixes #7, fixes #10.
This commit is contained in:
parent
7f20305350
commit
0544246f7c
1 changed files with 4 additions and 1 deletions
|
@ -87,6 +87,8 @@ def get_networks(client: docker.DockerClient, verbose: bool) -> typing.Dict[str,
|
||||||
color = get_unique_color()
|
color = get_unique_color()
|
||||||
networks[net.name] = Network(net.name, gateway, internal, isolated, color)
|
networks[net.name] = Network(net.name, gateway, internal, isolated, color)
|
||||||
|
|
||||||
|
networks["host"] = Network("host", "0.0.0.0", False, False, "#808080")
|
||||||
|
|
||||||
return networks
|
return networks
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +169,8 @@ def generate_graph(verbose: bool, file: str):
|
||||||
draw_container(g, container)
|
draw_container(g, container)
|
||||||
|
|
||||||
for link in links:
|
for link in links:
|
||||||
draw_link(g, networks, link)
|
if link.network_name != "none":
|
||||||
|
draw_link(g, networks, link)
|
||||||
|
|
||||||
if file:
|
if file:
|
||||||
g.render(base)
|
g.render(base)
|
||||||
|
|
Loading…
Reference in a new issue