Kaydet (Commit) 07d791d5 authored tarafından shin-'s avatar shin-

Moved docstrings into README.md for consistency.

üst cf46c4d2
...@@ -27,7 +27,8 @@ Identical to the `docker cp` command. ...@@ -27,7 +27,8 @@ Identical to the `docker cp` command.
* `c.create_container(image, command, hostname=None, user=None, detach=False, stdin_open=False, tty=False, mem_limit=0, ports=None, environment=None, dns=None, volumes=None, volumes_from=None, privileged=False)` * `c.create_container(image, command, hostname=None, user=None, detach=False, stdin_open=False, tty=False, mem_limit=0, ports=None, environment=None, dns=None, volumes=None, volumes_from=None, privileged=False)`
Creates a container that can then be `start`ed. Parameters are similar to those Creates a container that can then be `start`ed. Parameters are similar to those
for the `docker run` command except it doesn't support the attach options for the `docker run` command except it doesn't support the attach options
(`-a`) (`-a`)
In order to create volumes that can be rebinded at start time, use the following syntax: `volumes={"/srv": "" }`
* `c.diff(container)` * `c.diff(container)`
Identical to the `docker diff` command. Identical to the `docker diff` command.
...@@ -96,8 +97,8 @@ Similar to the `docker start` command, but doesn't support attach options. ...@@ -96,8 +97,8 @@ Similar to the `docker start` command, but doesn't support attach options.
Use `docker logs` to recover `stdout`/`stderr` Use `docker logs` to recover `stdout`/`stderr`
`binds` Allows to bind a directory in the host to the container. `binds` Allows to bind a directory in the host to the container.
Similar to the `docker run` command with option `-v="/host:/mnt"`. Similar to the `docker run` command with option `-v="/host:/mnt"`.
Requires the container to be created with the volumes argument: Note that you must declare "blank" volumes at container creation to use binds.
`c.create_container(..., volumes={'/mnt': {}})` Example of binds mapping from host to container: `{'/mnt/srv/': '/srv'}`
`lxc_conf` allows to pass LXC configuration options in dict form. `lxc_conf` allows to pass LXC configuration options in dict form.
* `c.stop(container, timeout=10)` * `c.stop(container, timeout=10)`
......
...@@ -231,14 +231,7 @@ class Client(requests.Session): ...@@ -231,14 +231,7 @@ class Client(requests.Session):
detach=False, stdin_open=False, tty=False, mem_limit=0, ports=None, detach=False, stdin_open=False, tty=False, mem_limit=0, ports=None,
environment=None, dns=None, volumes=None, volumes_from=None, environment=None, dns=None, volumes=None, volumes_from=None,
privileged=False): privileged=False):
'''
NOTES:
- To create modifiable volumes at start time, use::
volumes={"/srv": "" }
'''
config = self._container_config(image, command, hostname, user, config = self._container_config(image, command, hostname, user,
detach, stdin_open, tty, mem_limit, ports, environment, dns, detach, stdin_open, tty, mem_limit, ports, environment, dns,
...@@ -287,9 +280,6 @@ class Client(requests.Session): ...@@ -287,9 +280,6 @@ class Client(requests.Session):
return res return res
def import_image(self, src, data=None, repository=None, tag=None): def import_image(self, src, data=None, repository=None, tag=None):
'''
To import from a local tarball, use the absolute path to the file
'''
u = self._url("/images/create") u = self._url("/images/create")
params = { params = {
'repo': repository, 'repo': repository,
...@@ -444,16 +434,6 @@ class Client(requests.Session): ...@@ -444,16 +434,6 @@ class Client(requests.Session):
params={'term': term}), True) params={'term': term}), True)
def start(self, container, binds=None, lxc_conf=None): def start(self, container, binds=None, lxc_conf=None):
'''
NOTES:
- Remember that you must declare "blank" volumes
at container creation to use binds
- An example of binds mapping from host to container::
{'/mnt/srv/': '/srv'}
'''
if isinstance(container, dict): if isinstance(container, dict):
container = container.get('Id') container = container.get('Id')
start_config = { start_config = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment