@@ -733,7 +733,7 @@ def search(self, term):
733
733
734
734
@check_resource
735
735
def start (self , container , binds = None , port_bindings = None , lxc_conf = None ,
736
- publish_all_ports = False , links = None , privileged = False ,
736
+ publish_all_ports = None , links = None , privileged = None ,
737
737
dns = None , dns_search = None , volumes_from = None , network_mode = None ,
738
738
restart_policy = None , cap_add = None , cap_drop = None , devices = None ,
739
739
extra_hosts = None , read_only = None , pid_mode = None , ipc_mode = None ,
@@ -775,25 +775,27 @@ def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
775
775
'ulimits is only supported for API version >= 1.18'
776
776
)
777
777
778
- start_config = utils . create_host_config (
778
+ start_config_kwargs = dict (
779
779
binds = binds , port_bindings = port_bindings , lxc_conf = lxc_conf ,
780
780
publish_all_ports = publish_all_ports , links = links , dns = dns ,
781
781
privileged = privileged , dns_search = dns_search , cap_add = cap_add ,
782
782
cap_drop = cap_drop , volumes_from = volumes_from , devices = devices ,
783
- network_mode = network_mode or '' , restart_policy = restart_policy ,
783
+ network_mode = network_mode , restart_policy = restart_policy ,
784
784
extra_hosts = extra_hosts , read_only = read_only , pid_mode = pid_mode ,
785
785
ipc_mode = ipc_mode , security_opt = security_opt , ulimits = ulimits
786
786
)
787
+ start_config = None
788
+
789
+ if any (v is not None for v in start_config_kwargs .values ()):
790
+ if utils .compare_version ('1.15' , self ._version ) > 0 :
791
+ warnings .warn (
792
+ 'Passing host config parameters in start() is deprecated. '
793
+ 'Please use host_config in create_container instead!' ,
794
+ DeprecationWarning
795
+ )
796
+ start_config = utils .create_host_config (** start_config_kwargs )
787
797
788
798
url = self ._url ("/containers/{0}/start" .format (container ))
789
- if not start_config :
790
- start_config = None
791
- elif utils .compare_version ('1.15' , self ._version ) > 0 :
792
- warnings .warn (
793
- 'Passing host config parameters in start() is deprecated. '
794
- 'Please use host_config in create_container instead!' ,
795
- DeprecationWarning
796
- )
797
799
res = self ._post_json (url , data = start_config )
798
800
self ._raise_for_status (res )
799
801
0 commit comments