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()
|
||||
networks[net.name] = Network(net.name, gateway, internal, isolated, color)
|
||||
|
||||
networks["host"] = Network("host", "0.0.0.0", False, False, "#808080")
|
||||
|
||||
return networks
|
||||
|
||||
|
||||
|
@ -167,6 +169,7 @@ def generate_graph(verbose: bool, file: str):
|
|||
draw_container(g, container)
|
||||
|
||||
for link in links:
|
||||
if link.network_name != "none":
|
||||
draw_link(g, networks, link)
|
||||
|
||||
if file:
|
||||
|
|
Loading…
Reference in a new issue