summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-06-24 15:17:58 -0700
committerJoffrey F <joffrey@docker.com>2016-06-24 15:17:58 -0700
commit0de366da3de451939ee05ef636506333e4f1ca70 (patch)
treedb7d75096b3b87404abba67ee4933573a12eeb47
parent9010d594502853114d182f66a127f3108ecaa0cc (diff)
downloaddocker-py-1107-link-local-ips.tar.gz
Add support for link-local IPs in endpoint config1107-link-local-ips
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r--docker/api/network.py5
-rw-r--r--docker/utils/utils.py10
-rw-r--r--docs/api.md10
-rw-r--r--docs/networks.md1
4 files changed, 23 insertions, 3 deletions
diff --git a/docker/api/network.py b/docker/api/network.py
index a35f0a4..34cd898 100644
--- a/docker/api/network.py
+++ b/docker/api/network.py
@@ -60,12 +60,13 @@ class NetworkApiMixin(object):
@minimum_version('1.21')
def connect_container_to_network(self, container, net_id,
ipv4_address=None, ipv6_address=None,
- aliases=None, links=None):
+ aliases=None, links=None,
+ link_local_ips=None):
data = {
"Container": container,
"EndpointConfig": self.create_endpoint_config(
aliases=aliases, links=links, ipv4_address=ipv4_address,
- ipv6_address=ipv6_address
+ ipv6_address=ipv6_address, link_local_ips=link_local_ips
),
}
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index 2ef8ef0..b38cda4 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -873,7 +873,8 @@ def create_networking_config(endpoints_config=None):
def create_endpoint_config(version, aliases=None, links=None,
- ipv4_address=None, ipv6_address=None):
+ ipv4_address=None, ipv6_address=None,
+ link_local_ips=None):
if version_lt(version, '1.22'):
raise errors.InvalidVersion(
'Endpoint config is not supported for API version < 1.22'
@@ -896,6 +897,13 @@ def create_endpoint_config(version, aliases=None, links=None,
if ipam_config:
endpoint_config['IPAMConfig'] = ipam_config
+ if link_local_ips is not None:
+ if version_lt(version, '1.24'):
+ raise errors.InvalidVersion(
+ 'link_local_ips is not supported for API version < 1.24'
+ )
+ endpoint_config['LinkLocalIPs'] = link_local_ips
+
return endpoint_config
diff --git a/docs/api.md b/docs/api.md
index 51b6e27..5b8ef22 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -179,6 +179,16 @@ Connect a container to a network.
* container (str): container-id/name to be connected to the network
* net_id (str): network id
+* aliases (list): A list of aliases for this endpoint. Names in that list can
+ be used within the network to reach the container. Defaults to `None`.
+* links (list): A list of links for this endpoint. Containers declared in this
+ list will be [linked](https://docs.docker.com/engine/userguide/networking/work-with-networks/#linking-containers-in-user-defined-networks)
+ to this container. Defaults to `None`.
+* ipv4_address (str): The IP address of this container on the network,
+ using the IPv4 protocol. Defaults to `None`.
+* ipv6_address (str): The IP address of this container on the network,
+ using the IPv6 protocol. Defaults to `None`.
+* link_local_ips (list): A list of link-local (IPv4/IPv6) addresses.
## copy
Identical to the `docker cp` command. Get files/folders from the container.
diff --git a/docs/networks.md b/docs/networks.md
index ec45e1c..fb0e9f4 100644
--- a/docs/networks.md
+++ b/docs/networks.md
@@ -107,6 +107,7 @@ Create an endpoint config dictionary to be used with
using the IPv4 protocol. Defaults to `None`.
* ipv6_address (str): The IP address of this container on the network,
using the IPv6 protocol. Defaults to `None`.
+* link_local_ips (list): A list of link-local (IPv4/IPv6) addresses.
**Returns** An endpoint config dictionary.