@@ -248,15 +248,18 @@ def create_container(self, image, command=None, hostname=None, user=None,
248
248
'host_config is not supported in API < 1.15'
249
249
)
250
250
251
- config = utils .create_container_config (
252
- self . _version , image , command , hostname , user , detach , stdin_open ,
251
+ config = self .create_container_config (
252
+ image , command , hostname , user , detach , stdin_open ,
253
253
tty , mem_limit , ports , environment , dns , volumes , volumes_from ,
254
254
network_disabled , entrypoint , cpu_shares , working_dir , domainname ,
255
255
memswap_limit , cpuset , host_config , mac_address , labels ,
256
256
volume_driver
257
257
)
258
258
return self .create_container_from_config (config , name )
259
259
260
+ def create_container_config (self , * args , ** kwargs ):
261
+ return utils .create_container_config (self ._version , * args , ** kwargs )
262
+
260
263
def create_container_from_config (self , config , name = None ):
261
264
u = self ._url ("/containers/create" )
262
265
params = {
@@ -265,6 +268,12 @@ def create_container_from_config(self, config, name=None):
265
268
res = self ._post_json (u , data = config , params = params )
266
269
return self ._result (res , True )
267
270
271
+ def create_host_config (self , * args , ** kwargs ):
272
+ if not kwargs :
273
+ kwargs = {}
274
+ kwargs ['version' ] = self ._version
275
+ return utils .create_host_config (* args , ** kwargs )
276
+
268
277
@check_resource
269
278
def diff (self , container ):
270
279
return self ._result (self ._get (self ._url ("/containers/{0}/changes" .
@@ -815,7 +824,7 @@ def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
815
824
'Please use host_config in create_container instead!' ,
816
825
DeprecationWarning
817
826
)
818
- start_config = utils .create_host_config (** start_config_kwargs )
827
+ start_config = self .create_host_config (** start_config_kwargs )
819
828
820
829
url = self ._url ("/containers/{0}/start" .format (container ))
821
830
res = self ._post_json (url , data = start_config )
0 commit comments