mirror of https://github.com/docker/docker-py.git
Merge 2399c1a30c
into db7f8b8bb6
This commit is contained in:
commit
0660f9e3ae
|
@ -20,7 +20,8 @@ class DockerClient:
|
|||
Example:
|
||||
|
||||
>>> import docker
|
||||
>>> client = docker.DockerClient(base_url='unix://var/run/docker.sock')
|
||||
>>> with docker.DockerClient(base_url='unix://var/run/docker.sock') as client:
|
||||
...
|
||||
|
||||
Args:
|
||||
base_url (str): URL to the Docker server. For example,
|
||||
|
@ -209,6 +210,16 @@ class DockerClient:
|
|||
return self.api.close()
|
||||
close.__doc__ = APIClient.close.__doc__
|
||||
|
||||
def __enter__(self):
|
||||
self.api.__enter__()
|
||||
return self
|
||||
|
||||
__enter__.__doc__ = APIClient.__enter__.__doc__
|
||||
|
||||
def __exit__(self, *args, **kwargs):
|
||||
return self.api.__exit__(*args, **kwargs)
|
||||
__exit__.__doc__ = APIClient.__exit__.__doc__
|
||||
|
||||
def __getattr__(self, name):
|
||||
s = [f"'DockerClient' object has no attribute '{name}'"]
|
||||
# If a user calls a method on APIClient, they
|
||||
|
|
Loading…
Reference in New Issue