diff --git a/README.md b/README.md index fb1e659c..325a9277 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,13 @@ The `logs` function is a wrapper around this one, which you can use instead if you want to fetch/stream container output without first retrieving the entire backlog. +```python +c.ping() +``` + +Hits the /_ping endpoint of the remote API and returns the result. +An exception will be raised if the endpoint isn't responding. + ```python c.port(container, private_port) ``` diff --git a/docker/client.py b/docker/client.py index ad46e3c0..f76f0917 100644 --- a/docker/client.py +++ b/docker/client.py @@ -616,6 +616,9 @@ class Client(requests.Session): logs=True ) + def ping(self): + return self._result(self._get(self._url('/_ping'))) + def port(self, container, private_port): if isinstance(container, dict): container = container.get('Id')