summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Hensley <spaceboy@indirect.com>2014-10-04 23:14:24 -0400
committerPatrick Hensley <spaceboy@indirect.com>2014-10-04 23:18:44 -0400
commit75e53f1add3ab5f57984938d346d23e3be840546 (patch)
treeae3809da5cb285f021d1b14e347804536c4ff67d
parent7a462970852a2578c3869e581a57dd70eaa22217 (diff)
downloaddocker-py-75e53f1add3ab5f57984938d346d23e3be840546.tar.gz
Added pause/unpause methods.
-rw-r--r--README.md12
-rw-r--r--docker/client.py14
2 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md
index 52139b2..659c26c 100644
--- a/README.md
+++ b/README.md
@@ -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')