diff options
author | Patrick Hensley <spaceboy@indirect.com> | 2014-10-04 23:14:24 -0400 |
---|---|---|
committer | Patrick Hensley <spaceboy@indirect.com> | 2014-10-04 23:18:44 -0400 |
commit | 75e53f1add3ab5f57984938d346d23e3be840546 (patch) | |
tree | ae3809da5cb285f021d1b14e347804536c4ff67d | |
parent | 7a462970852a2578c3869e581a57dd70eaa22217 (diff) | |
download | docker-py-75e53f1add3ab5f57984938d346d23e3be840546.tar.gz |
Added pause/unpause methods.
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | docker/client.py | 14 |
2 files changed, 26 insertions, 0 deletions
@@ -182,6 +182,12 @@ instead if you want to fetch/stream container output without first retrieving the entire backlog. ```python +c.pause(container) +``` + +Pauses all processes within a container. + +```python c.ping() ``` @@ -308,6 +314,12 @@ c.top(container) Identical to the `docker top` command. ```python +c.unpause(container) +``` + +Unpauses all processes within a container. + +```python c.version() ``` diff --git a/docker/client.py b/docker/client.py index 1ff43cc..b07796a 100644 --- a/docker/client.py +++ b/docker/client.py @@ -696,6 +696,13 @@ class Client(requests.Session): logs=True ) + def pause(self, container): + if isinstance(container, dict): + container = container.get('Id') + url = self._url('/containers/{0}/pause'.format(container)) + res = self._post(url) + self._raise_for_status(res) + def ping(self): return self._result(self._get(self._url('/_ping'))) @@ -922,6 +929,13 @@ class Client(requests.Session): def version(self): return self._result(self._get(self._url("/version")), True) + def unpause(self, container): + if isinstance(container, dict): + container = container.get('Id') + url = self._url('/containers/{0}/unpause'.format(container)) + res = self._post(url) + self._raise_for_status(res) + def wait(self, container): if isinstance(container, dict): container = container.get('Id') |