Skip to content

Commit d8e5aac

Browse files
authored
Exclude the 'networks' key if only the default bridge network is present
1 parent 0556a35 commit d8e5aac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

autocompose.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def generate(cname):
6060
#'log_driver': cattrs['HostConfig']['LogConfig']['Type'],
6161
#'log_opt': cattrs['HostConfig']['LogConfig']['Config'],
6262
'logging': {'driver': cattrs['HostConfig']['LogConfig']['Type'], 'options': cattrs['HostConfig']['LogConfig']['Config']},
63-
'networks': {x for x in cattrs['NetworkSettings']['Networks'].keys()},
63+
'networks': {x for x in cattrs['NetworkSettings']['Networks'].keys() if x != 'bridge'},
6464
'security_opt': cattrs['HostConfig']['SecurityOpt'],
6565
'ulimits': cattrs['HostConfig']['Ulimits'],
6666
'volumes': cattrs['HostConfig']['Binds'],
@@ -80,6 +80,9 @@ def generate(cname):
8080
'tty': cattrs['Config']['Tty']
8181
}
8282

83+
if values['networks'] == set():
84+
del values['networks']
85+
8386
networklist = c.networks.list()
8487
networks = {}
8588
for network in networklist:

0 commit comments

Comments
 (0)