Merge pull request #224 from discordianfish/add-hostconfig-net

Add NetMode to hostConfig in start
This commit is contained in:
Joffrey F 2014-05-13 21:28:58 +02:00
commit 1b574598e0
2 changed files with 11 additions and 2 deletions

View File

@ -213,7 +213,7 @@ Identical to the `docker search` command.
```python
c.start(container, binds=None, port_bindings=None, lxc_conf=None,
publish_all_ports=False, links=None, privileged=False,
dns=None, volumes_from=None)
dns=None, volumes_from=None, network_mode=None)
```
Similar to the `docker start` command, but doesn't support attach
@ -233,6 +233,12 @@ specified as a dictionary mapping name to alias or as a list of
`dns` and `volumes_from` are only available if they are used with version v1.10
of docker remote API. Otherwise they are ignored.
`network_mode` is available since v1.11 and sets the Network mode for the
container ('bridge': creates a new network stack for the container on the
docker bridge, 'none': no networking for this container, 'container:[name|id]':
reuses another container network stack), 'host': use the host network stack
inside the container.
```python
c.stop(container, timeout=10)
```

View File

@ -688,7 +688,7 @@ class Client(requests.Session):
def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
publish_all_ports=False, links=None, privileged=False,
dns=None, volumes_from=None):
dns=None, volumes_from=None, network_mode=None):
if isinstance(container, dict):
container = container.get('Id')
@ -742,6 +742,9 @@ class Client(requests.Session):
warnings.warn(warning_message.format('volumes_from'),
DeprecationWarning)
if network_mode:
start_config['NetworkMode'] = network_mode
url = self._url("/containers/{0}/start".format(container))
res = self._post_json(url, data=start_config)
self._raise_for_status(res)