@@ -473,16 +473,12 @@ def create_host_config(self, *args, **kwargs):
473473 signals and reaps processes
474474 init_path (str): Path to the docker-init binary
475475 ipc_mode (str): Set the IPC mode for the container.
476- isolation (str): Isolation technology to use. Default: `None`.
477- links (dict or list of tuples): Either a dictionary mapping name
478- to alias or as a list of ``(name, alias)`` tuples.
479- log_config (dict): Logging configuration, as a dictionary with
480- keys:
481-
482- - ``type`` The logging driver name.
483- - ``config`` A dictionary of configuration for the logging
484- driver.
485-
476+ isolation (str): Isolation technology to use. Default: ``None``.
477+ links (dict): Mapping of links using the
478+ ``{'container': 'alias'}`` format. The alias is optional.
479+ Containers declared in this dict will be linked to the new
480+ container using the provided alias. Default: ``None``.
481+ log_config (LogConfig): Logging configuration
486482 lxc_conf (dict): LXC config.
487483 mem_limit (float or str): Memory limit. Accepts float values
488484 (which represent the memory limit of the created container in
@@ -543,7 +539,7 @@ def create_host_config(self, *args, **kwargs):
543539 }
544540
545541 ulimits (:py:class:`list`): Ulimits to set inside the container,
546- as a list of dicts .
542+ as a list of :py:class:`docker.types.Ulimit` instances .
547543 userns_mode (str): Sets the user namespace mode for the container
548544 when user namespace remapping option is enabled. Supported
549545 values are: ``host``
@@ -611,9 +607,10 @@ def create_endpoint_config(self, *args, **kwargs):
611607 aliases (:py:class:`list`): A list of aliases for this endpoint.
612608 Names in that list can be used within the network to reach the
613609 container. Defaults to ``None``.
614- links (:py:class:`list`): A list of links for this endpoint.
615- Containers declared in this list will be linked to this
616- container. Defaults to ``None``.
610+ links (dict): Mapping of links for this endpoint using the
611+ ``{'container': 'alias'}`` format. The alias is optional.
612+ Containers declared in this dict will be linked to this
613+ container using the provided alias. Defaults to ``None``.
617614 ipv4_address (str): The IP address of this container on the
618615 network, using the IPv4 protocol. Defaults to ``None``.
619616 ipv6_address (str): The IP address of this container on the
@@ -628,7 +625,7 @@ def create_endpoint_config(self, *args, **kwargs):
628625
629626 >>> endpoint_config = client.create_endpoint_config(
630627 aliases=['web', 'app'],
631- links=[ 'app_db'] ,
628+ links={ 'app_db': 'db', 'another': None} ,
632629 ipv4_address='132.65.0.123'
633630 )
634631
@@ -697,6 +694,18 @@ def get_archive(self, container, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
697694 Raises:
698695 :py:class:`docker.errors.APIError`
699696 If the server returns an error.
697+
698+ Example:
699+
700+ >>> c = docker.APIClient()
701+ >>> f = open('./sh_bin.tar', 'wb')
702+ >>> bits, stat = c.get_archive(container, '/bin/sh')
703+ >>> print(stat)
704+ {'name': 'sh', 'size': 1075464, 'mode': 493,
705+ 'mtime': '2018-10-01T15:37:48-07:00', 'linkTarget': ''}
706+ >>> for chunk in bits:
707+ ... f.write(chunk)
708+ >>> f.close()
700709 """
701710 params = {
702711 'path' : path
@@ -1074,7 +1083,8 @@ def stats(self, container, decode=None, stream=True):
10741083 Args:
10751084 container (str): The container to stream statistics from
10761085 decode (bool): If set to true, stream will be decoded into dicts
1077- on the fly. False by default.
1086+ on the fly. Only applicable if ``stream`` is True.
1087+ False by default.
10781088 stream (bool): If set to false, only the current stats will be
10791089 returned instead of a stream. True by default.
10801090
@@ -1088,6 +1098,10 @@ def stats(self, container, decode=None, stream=True):
10881098 return self ._stream_helper (self ._get (url , stream = True ),
10891099 decode = decode )
10901100 else :
1101+ if decode :
1102+ raise errors .InvalidArgument (
1103+ "decode is only available in conjuction with stream=True"
1104+ )
10911105 return self ._result (self ._get (url , params = {'stream' : False }),
10921106 json = True )
10931107
0 commit comments