diff options
author | Joffrey F <joffrey@docker.com> | 2017-05-11 17:44:23 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2017-05-12 14:28:27 -0700 |
commit | 95297dc2e760b992d7d31d485a66d02728944f36 (patch) | |
tree | 5ef3893b1c2850a6dd5d9f0db3f9bd6cde55f586 /docker | |
parent | 007ab677a1ff7748596ca7703ad05d89a4c881cd (diff) | |
download | docker-py-1433-run-networks.tar.gz |
Replace erroneous networks argument in containers.run with singular1433-run-networks
network equivalent.
Small docfixes
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker')
-rw-r--r-- | docker/models/containers.py | 23 | ||||
-rw-r--r-- | docker/models/plugins.py | 4 | ||||
-rw-r--r-- | docker/types/services.py | 2 |
3 files changed, 19 insertions, 10 deletions
diff --git a/docker/models/containers.py b/docker/models/containers.py index 7a1cd71..4bb2cf8 100644 --- a/docker/models/containers.py +++ b/docker/models/containers.py @@ -147,7 +147,7 @@ class Container(Model): Returns: (generator or str): If ``stream=True``, a generator yielding - response chunks. A string containing response data otherwise. + response chunks. A string containing response data otherwise. Raises: :py:class:`docker.errors.APIError` @@ -546,10 +546,12 @@ class ContainerCollection(Collection): behavior. Accepts number between 0 and 100. memswap_limit (str or int): Maximum amount of memory + swap a container is allowed to consume. - networks (:py:class:`list`): A list of network names to connect - this container to. name (str): The name for this container. nano_cpus (int): CPU quota in units of 10-9 CPUs. + network (str): Name of the network this container will be connected + to at creation time. You can connect to additional networks + using :py:meth:`Network.connect`. Incompatible with + ``network_mode``. network_disabled (bool): Disable networking. network_mode (str): One of: @@ -559,6 +561,7 @@ class ContainerCollection(Collection): - ``container:<name|id>`` Reuse another container's network stack. - ``host`` Use the host network stack. + Incompatible with ``network``. oom_kill_disable (bool): Whether to disable OOM killer. oom_score_adj (int): An integer value containing the score given to the container in order to tune OOM killer preferences. @@ -680,6 +683,12 @@ class ContainerCollection(Collection): raise RuntimeError("The options 'detach' and 'remove' cannot be " "used together.") + if kwargs.get('network') and kwargs.get('network_mode'): + raise RuntimeError( + 'The options "network" and "network_mode" can not be used ' + 'together.' + ) + try: container = self.create(image=image, command=command, detach=detach, **kwargs) @@ -902,10 +911,10 @@ def _create_container_args(kwargs): if volumes: host_config_kwargs['binds'] = volumes - networks = kwargs.pop('networks', []) - if networks: - create_kwargs['networking_config'] = {network: None - for network in networks} + network = kwargs.pop('network', None) + if network: + create_kwargs['networking_config'] = {network: None} + host_config_kwargs['network_mode'] = network # All kwargs should have been consumed by this point, so raise # error if any are left diff --git a/docker/models/plugins.py b/docker/models/plugins.py index 6cdf01c..0688018 100644 --- a/docker/models/plugins.py +++ b/docker/models/plugins.py @@ -103,8 +103,8 @@ class Plugin(Model): Args: remote (string): Remote reference to upgrade to. The - ``:latest`` tag is optional and is the default if omitted. - Default: this plugin's name. + ``:latest`` tag is optional and is the default if omitted. + Default: this plugin's name. Returns: A generator streaming the decoded API logs diff --git a/docker/types/services.py b/docker/types/services.py index 07409cd..012f7b0 100644 --- a/docker/types/services.py +++ b/docker/types/services.py @@ -127,7 +127,7 @@ class ContainerSpec(dict): class Mount(dict): """ Describes a mounted folder's configuration inside a container. A list of - :py:class:`Mount`s would be used as part of a + :py:class:`Mount` would be used as part of a :py:class:`~docker.types.ContainerSpec`. Args: |