client

Module Contents

Classes

DockerClient(self,*args,**kwargs) A client for communicating with a Docker server.
class DockerClient(*args, **kwargs)

A client for communicating with a Docker server.

Example:

>>> import docker
>>> client = docker.DockerClient(base_url='unix://var/run/docker.sock')
Args:
base_url (str): URL to the Docker server. For example,
unix:///var/run/docker.sock or tcp://127.0.0.1:1234.
version (str): The version of the API to use. Set to auto to
automatically detect the server’s version. Default: 1.30

timeout (int): Default timeout for API calls, in seconds. tls (bool or TLSConfig): Enable TLS. Pass

True to enable it with default options, or pass a TLSConfig object to use custom configuration.

user_agent (str): Set a custom user agent for requests to the server. credstore_env (dict): Override environment variables when calling the

credential store process.
__init__(*args, **kwargs)
from_env(**kwargs)

Return a client configured from environment variables.

The environment variables used are the same as those used by the Docker command-line client. They are:

DOCKER_HOST

The URL to the Docker host.

DOCKER_TLS_VERIFY

Verify the host against a CA certificate.

DOCKER_CERT_PATH

A path to a directory containing TLS certificates to use when connecting to the Docker host.

Args:
version (str): The version of the API to use. Set to auto to
automatically detect the server’s version. Default: 1.30

timeout (int): Default timeout for API calls, in seconds. ssl_version (int): A valid SSL version. assert_hostname (bool): Verify the hostname of the server. environment (dict): The environment to read environment variables

from. Default: the value of os.environ
credstore_env (dict): Override environment variables when calling
the credential store process.

Example:

>>> import docker
>>> client = docker.from_env()
configs()

An object for managing configs on the server. See the configs documentation for full details.

containers()

An object for managing containers on the server. See the containers documentation for full details.

images()

An object for managing images on the server. See the images documentation for full details.

networks()

An object for managing networks on the server. See the networks documentation for full details.

nodes()

An object for managing nodes on the server. See the nodes documentation for full details.

plugins()

An object for managing plugins on the server. See the plugins documentation for full details.

secrets()

An object for managing secrets on the server. See the secrets documentation for full details.

services()

An object for managing services on the server. See the services documentation for full details.

swarm()

An object for managing a swarm on the server. See the swarm documentation for full details.

volumes()

An object for managing volumes on the server. See the volumes documentation for full details.

events(*args, **kwargs)
df()
info(*args, **kwargs)
login(*args, **kwargs)
ping(*args, **kwargs)
version(*args, **kwargs)
close()
__getattr__(name)