@@ -473,16 +473,12 @@ def create_host_config(self, *args, **kwargs):
473
473
signals and reaps processes
474
474
init_path (str): Path to the docker-init binary
475
475
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
486
482
lxc_conf (dict): LXC config.
487
483
mem_limit (float or str): Memory limit. Accepts float values
488
484
(which represent the memory limit of the created container in
@@ -543,7 +539,7 @@ def create_host_config(self, *args, **kwargs):
543
539
}
544
540
545
541
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 .
547
543
userns_mode (str): Sets the user namespace mode for the container
548
544
when user namespace remapping option is enabled. Supported
549
545
values are: ``host``
@@ -611,9 +607,10 @@ def create_endpoint_config(self, *args, **kwargs):
611
607
aliases (:py:class:`list`): A list of aliases for this endpoint.
612
608
Names in that list can be used within the network to reach the
613
609
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``.
617
614
ipv4_address (str): The IP address of this container on the
618
615
network, using the IPv4 protocol. Defaults to ``None``.
619
616
ipv6_address (str): The IP address of this container on the
@@ -628,7 +625,7 @@ def create_endpoint_config(self, *args, **kwargs):
628
625
629
626
>>> endpoint_config = client.create_endpoint_config(
630
627
aliases=['web', 'app'],
631
- links=[ 'app_db'] ,
628
+ links={ 'app_db': 'db', 'another': None} ,
632
629
ipv4_address='132.65.0.123'
633
630
)
634
631
@@ -697,6 +694,18 @@ def get_archive(self, container, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
697
694
Raises:
698
695
:py:class:`docker.errors.APIError`
699
696
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()
700
709
"""
701
710
params = {
702
711
'path' : path
@@ -1074,7 +1083,8 @@ def stats(self, container, decode=None, stream=True):
1074
1083
Args:
1075
1084
container (str): The container to stream statistics from
1076
1085
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.
1078
1088
stream (bool): If set to false, only the current stats will be
1079
1089
returned instead of a stream. True by default.
1080
1090
@@ -1088,6 +1098,10 @@ def stats(self, container, decode=None, stream=True):
1088
1098
return self ._stream_helper (self ._get (url , stream = True ),
1089
1099
decode = decode )
1090
1100
else :
1101
+ if decode :
1102
+ raise errors .InvalidArgument (
1103
+ "decode is only available in conjuction with stream=True"
1104
+ )
1091
1105
return self ._result (self ._get (url , params = {'stream' : False }),
1092
1106
json = True )
1093
1107
0 commit comments