@@ -171,6 +171,11 @@ def set_network(self, params):
171
171
# if not specified, set the default value for the property
172
172
for key in ["enable" , "allocate_ip" ]:
173
173
self .network [key ] = self .network .get (key , True )
174
+
175
+ fakeroot = "--fakeroot" in self .start_opts or "-f" in self .start_opts
176
+ default_network_value = "fakeroot" if fakeroot else "bridge"
177
+
178
+ self .network ["type" ] = self .network .get ("type" , default_network_value if self .network ["enable" ] is True else "none" )
174
179
175
180
def set_ports (self , params ):
176
181
"""
@@ -240,7 +245,7 @@ def _get_network_commands(self, ip_address=None, network_type=None):
240
245
# network_type is "bridge" by default when network.enable is True
241
246
ports += ["--network" , network_type ]
242
247
243
- if network_type is None and (not self .sudo and not fakeroot ):
248
+ if network_type is None : # and (not self.sudo and not fakeroot):
244
249
ports += ["--network" , "none" ]
245
250
246
251
for pair in self .ports :
@@ -609,8 +614,9 @@ def create(self, ip_address=None, sudo=False, writable_tmpfs=False):
609
614
# Network configuration + Ports
610
615
if self .network ["enable" ]:
611
616
# if network.enable is true a --network must be always added
612
- # using bridge as default
613
- network_type = self .network ["type" ] or "bridge"
617
+ # using bridge or fakeroot as default
618
+ fakeroot = "--fakeroot" in self .start_opts or "-f" in self .start_opts
619
+ network_type = self .network ["type" ] or "fakeroot" if fakeroot else "bridge"
614
620
options += self ._get_network_commands (ip_address , network_type )
615
621
616
622
# Start options
0 commit comments