mirror of https://github.com/docker/docker-py.git
Merge pull request #224 from discordianfish/add-hostconfig-net
Add NetMode to hostConfig in start
This commit is contained in:
commit
1b574598e0
|
|
@ -213,7 +213,7 @@ Identical to the `docker search` command.
|
||||||
```python
|
```python
|
||||||
c.start(container, binds=None, port_bindings=None, lxc_conf=None,
|
c.start(container, binds=None, port_bindings=None, lxc_conf=None,
|
||||||
publish_all_ports=False, links=None, privileged=False,
|
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
|
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
|
`dns` and `volumes_from` are only available if they are used with version v1.10
|
||||||
of docker remote API. Otherwise they are ignored.
|
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
|
```python
|
||||||
c.stop(container, timeout=10)
|
c.stop(container, timeout=10)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,7 @@ class Client(requests.Session):
|
||||||
|
|
||||||
def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
|
def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
|
||||||
publish_all_ports=False, links=None, privileged=False,
|
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):
|
if isinstance(container, dict):
|
||||||
container = container.get('Id')
|
container = container.get('Id')
|
||||||
|
|
||||||
|
|
@ -742,6 +742,9 @@ class Client(requests.Session):
|
||||||
warnings.warn(warning_message.format('volumes_from'),
|
warnings.warn(warning_message.format('volumes_from'),
|
||||||
DeprecationWarning)
|
DeprecationWarning)
|
||||||
|
|
||||||
|
if network_mode:
|
||||||
|
start_config['NetworkMode'] = network_mode
|
||||||
|
|
||||||
url = self._url("/containers/{0}/start".format(container))
|
url = self._url("/containers/{0}/start".format(container))
|
||||||
res = self._post_json(url, data=start_config)
|
res = self._post_json(url, data=start_config)
|
||||||
self._raise_for_status(res)
|
self._raise_for_status(res)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue