mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-05-04 05:42:44 -04:00
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
84 lines
3.3 KiB
Python
Generated
84 lines
3.3 KiB
Python
Generated
from typing import Any
|
|
from typing import Self
|
|
|
|
from .models.containers import ContainerCollection
|
|
|
|
class DockerClient:
|
|
"""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.35``
|
|
timeout (int): Default timeout for API calls, in seconds.
|
|
tls (bool or :py:class:`~docker.tls.TLSConfig`): Enable TLS. Pass
|
|
``True`` to enable it with default options, or pass a
|
|
:py:class:`~docker.tls.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.
|
|
use_ssh_client (bool): If set to `True`, an ssh connection is made
|
|
via shelling out to the ssh client. Ensure the ssh client is
|
|
installed and configured on the host.
|
|
max_pool_size (int): The maximum number of connections
|
|
to save in the pool.
|
|
"""
|
|
|
|
@classmethod
|
|
def from_env(cls, **kwargs: Any) -> Self:
|
|
"""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:
|
|
|
|
.. envvar:: DOCKER_HOST
|
|
|
|
The URL to the Docker host.
|
|
|
|
.. envvar:: DOCKER_TLS_VERIFY
|
|
|
|
Verify the host against a CA certificate.
|
|
|
|
.. envvar:: 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: ``auto``
|
|
timeout (int): Default timeout for API calls, in seconds.
|
|
max_pool_size (int): The maximum number of connections
|
|
to save in the pool.
|
|
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.
|
|
use_ssh_client (bool): If set to `True`, an ssh connection is
|
|
made via shelling out to the ssh client. Ensure the ssh
|
|
client is installed and configured on the host.
|
|
|
|
Example:
|
|
>>> import docker
|
|
>>> client = docker.from_env()
|
|
|
|
.. _`SSL version`:
|
|
https://docs.python.org/3.5/library/ssl.html#ssl.PROTOCOL_TLSv1
|
|
"""
|
|
@property
|
|
def containers(self) -> ContainerCollection:
|
|
"""An object for managing containers on the server. See the
|
|
:doc:`containers documentation <containers>` for full details.
|
|
"""
|
|
...
|
|
|
|
def from_env(**attrs: Any) -> DockerClient: ...
|