mirror of https://github.com/docker/docker-py.git
Added lxc_conf param to Client.start
This commit is contained in:
parent
e2e5b9e0fd
commit
e07e0599e8
11
README.md
11
README.md
|
@ -89,13 +89,14 @@ Restart a container. Similar to the `docker restart` command.
|
|||
* `c.search(term)`
|
||||
Identical to the `docker search` command.
|
||||
|
||||
* `c.start(container, binds=None)`
|
||||
Identical to the `docker start` command, but doesn't support attach options.
|
||||
Use `docker logs` to recover `stdout`/`stderr`
|
||||
* `c.start(container, binds=None, lxc_conf=None)`
|
||||
Similar to the `docker start` command, but doesn't support attach options.
|
||||
Use `docker logs` to recover `stdout`/`stderr`
|
||||
`binds` Allows to bind a directory in the host to the container.
|
||||
Similar to the `docker run` command with option `-b="/host:/mnt"`.
|
||||
Similar to the `docker run` command with option `-b="/host:/mnt"`.
|
||||
Requires the container to be created with the volumes argument:
|
||||
`c.create_container(..., volumes={'/mnt': {}})`
|
||||
`c.create_container(..., volumes={'/mnt': {}})`
|
||||
`lxc_conf` allows to pass LXC configuration options in dict form.
|
||||
|
||||
* `c.stop(containers, timeout=10)`
|
||||
Stops a container. Similar to the `docker stop` command.
|
||||
|
|
|
@ -413,15 +413,16 @@ class Client(requests.Session):
|
|||
return self._result(self.get(self._url("/images/search"),
|
||||
params={'term': term}), True)
|
||||
|
||||
def start(self, container, binds=None):
|
||||
def start(self, container, binds=None, lxc_conf=None):
|
||||
if isinstance(container, dict):
|
||||
container = container.get('Id')
|
||||
start_config = {}
|
||||
start_config = {
|
||||
'LxcConf': lxc_conf
|
||||
}
|
||||
if binds:
|
||||
bind_pairs = ['{0}:{1}'.format(host, dest) for host, dest in binds.items()]
|
||||
start_config = {
|
||||
'Binds': bind_pairs,
|
||||
}
|
||||
start_config['Binds'] = bind_pairs
|
||||
|
||||
url = self._url("/containers/{0}/start".format(container))
|
||||
res = self._post_json(url, start_config)
|
||||
self._raise_for_status(res)
|
||||
|
|
Loading…
Reference in New Issue