code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def parse_auth(cls, entries, raise_on_error=False):
"""
Parses authentication entries
Args:
entries: Dict of authentication entries.
raise_on_error: If set to true, an invalid format will raise
InvalidConfigFile
Returns:
Au... |
Parses authentication entries
Args:
entries: Dict of authentication entries.
raise_on_error: If set to true, an invalid format will raise
InvalidConfigFile
Returns:
Authentication registry.
| parse_auth | python | docker/docker-py | docker/auth.py | https://github.com/docker/docker-py/blob/master/docker/auth.py | Apache-2.0 |
def load_config(cls, config_path, config_dict, credstore_env=None):
"""
Loads authentication data from a Docker configuration file in the given
root directory or if config_path is passed use given path.
Lookup priority:
explicit config_path parameter > DOCKER_CONFIG environme... |
Loads authentication data from a Docker configuration file in the given
root directory or if config_path is passed use given path.
Lookup priority:
explicit config_path parameter > DOCKER_CONFIG environment
variable > ~/.docker/config.json > ~/.dockercfg
| load_config | python | docker/docker-py | docker/auth.py | https://github.com/docker/docker-py/blob/master/docker/auth.py | Apache-2.0 |
def resolve_authconfig(self, registry=None):
"""
Returns the authentication data from the given auth configuration for a
specific registry. As with the Docker client, legacy entries in the
config with full URLs are stripped down to hostnames before checking
for a match. Returns N... |
Returns the authentication data from the given auth configuration for a
specific registry. As with the Docker client, legacy entries in the
config with full URLs are stripped down to hostnames before checking
for a match. Returns None if no match was found.
| resolve_authconfig | python | docker/docker-py | docker/auth.py | https://github.com/docker/docker-py/blob/master/docker/auth.py | Apache-2.0 |
def from_env(cls, **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:
.. envvar:: DOCKER_HOST
The URL to the Docker host.
.. envvar:: D... |
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... | from_env | python | docker/docker-py | docker/client.py | https://github.com/docker/docker-py/blob/master/docker/client.py | Apache-2.0 |
def create_api_error_from_http_exception(e):
"""
Create a suitable APIError from requests.exceptions.HTTPError.
"""
response = e.response
try:
explanation = response.json()['message']
except ValueError:
explanation = (response.text or '').strip()
cls = APIError
if respons... |
Create a suitable APIError from requests.exceptions.HTTPError.
| create_api_error_from_http_exception | python | docker/docker-py | docker/errors.py | https://github.com/docker/docker-py/blob/master/docker/errors.py | Apache-2.0 |
def configure_client(self, client):
"""
Configure a client with these TLS options.
"""
if self.verify and self.ca_cert:
client.verify = self.ca_cert
else:
client.verify = self.verify
if self.cert:
client.cert = self.cert |
Configure a client with these TLS options.
| configure_client | python | docker/docker-py | docker/tls.py | https://github.com/docker/docker-py/blob/master/docker/tls.py | Apache-2.0 |
def prune_builds(self, filters=None, keep_storage=None, all=None):
"""
Delete the builder cache
Args:
filters (dict): Filters to process on the prune list.
Needs Docker API v1.39+
Available filters:
- dangling (bool): When set to true... |
Delete the builder cache
Args:
filters (dict): Filters to process on the prune list.
Needs Docker API v1.39+
Available filters:
- dangling (bool): When set to true (or 1), prune only
unused and untagged images.
... | prune_builds | python | docker/docker-py | docker/api/build.py | https://github.com/docker/docker-py/blob/master/docker/api/build.py | Apache-2.0 |
def _raise_for_status(self, response):
"""Raises stored :class:`APIError`, if one occurred."""
try:
response.raise_for_status()
except requests.exceptions.HTTPError as e:
raise create_api_error_from_http_exception(e) from e | Raises stored :class:`APIError`, if one occurred. | _raise_for_status | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def _stream_helper(self, response, decode=False):
"""Generator for data coming from a chunked-encoded HTTP response."""
if response.raw._fp.chunked:
if decode:
yield from json_stream(self._stream_helper(response, False))
else:
reader = response.ra... | Generator for data coming from a chunked-encoded HTTP response. | _stream_helper | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def _multiplexed_buffer_helper(self, response):
"""A generator of multiplexed data blocks read from a buffered
response."""
buf = self._result(response, binary=True)
buf_length = len(buf)
walker = 0
while True:
if buf_length - walker < STREAM_HEADER_SIZE_BYTES... | A generator of multiplexed data blocks read from a buffered
response. | _multiplexed_buffer_helper | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def _multiplexed_response_stream_helper(self, response):
"""A generator of multiplexed data blocks coming from a response
stream."""
# Disable timeout on the underlying socket to prevent
# Read timed out(s) for long running processes
socket = self._get_raw_response_socket(respon... | A generator of multiplexed data blocks coming from a response
stream. | _multiplexed_response_stream_helper | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def _stream_raw_result(self, response, chunk_size=1, decode=True):
''' Stream result for TTY-enabled container and raw binary data'''
self._raise_for_status(response)
# Disable timeout on the underlying socket to prevent
# Read timed out(s) for long running processes
socket = se... | Stream result for TTY-enabled container and raw binary data | _stream_raw_result | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def _read_from_socket(self, response, stream, tty=True, demux=False):
"""Consume all data from the socket, close the response and return the
data. If stream=True, then a generator is returned instead and the
caller is responsible for closing the response.
"""
socket = self._get_r... | Consume all data from the socket, close the response and return the
data. If stream=True, then a generator is returned instead and the
caller is responsible for closing the response.
| _read_from_socket | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def _disable_socket_timeout(self, socket):
""" Depending on the combination of python version and whether we're
connecting over http or https, we might need to access _sock, which
may or may not exist; or we may need to just settimeout on socket
itself, which also may or may not have set... | Depending on the combination of python version and whether we're
connecting over http or https, we might need to access _sock, which
may or may not exist; or we may need to just settimeout on socket
itself, which also may or may not have settimeout on it. To avoid
missing the correct on... | _disable_socket_timeout | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def reload_config(self, dockercfg_path=None):
"""
Force a reload of the auth configuration
Args:
dockercfg_path (str): Use a custom path for the Docker config file
(default ``$HOME/.docker/config.json`` if present,
otherwise ``$HOME/.dockercfg``)
... |
Force a reload of the auth configuration
Args:
dockercfg_path (str): Use a custom path for the Docker config file
(default ``$HOME/.docker/config.json`` if present,
otherwise ``$HOME/.dockercfg``)
Returns:
None
| reload_config | python | docker/docker-py | docker/api/client.py | https://github.com/docker/docker-py/blob/master/docker/api/client.py | Apache-2.0 |
def create_config(self, name, data, labels=None, templating=None):
"""
Create a config
Args:
name (string): Name of the config
data (bytes): Config data to be stored
labels (dict): A mapping of labels to assign to the config
... |
Create a config
Args:
name (string): Name of the config
data (bytes): Config data to be stored
labels (dict): A mapping of labels to assign to the config
templating (dict): dictionary containing the name of the
... | create_config | python | docker/docker-py | docker/api/config.py | https://github.com/docker/docker-py/blob/master/docker/api/config.py | Apache-2.0 |
def inspect_config(self, id):
"""
Retrieve config metadata
Args:
id (string): Full ID of the config to inspect
Returns (dict): A dictionary of metadata
Raises:
:py:class:`docker.errors.NotFound`
if no config w... |
Retrieve config metadata
Args:
id (string): Full ID of the config to inspect
Returns (dict): A dictionary of metadata
Raises:
:py:class:`docker.errors.NotFound`
if no config with that ID exists
| inspect_config | python | docker/docker-py | docker/api/config.py | https://github.com/docker/docker-py/blob/master/docker/api/config.py | Apache-2.0 |
def remove_config(self, id):
"""
Remove a config
Args:
id (string): Full ID of the config to remove
Returns (boolean): True if successful
Raises:
:py:class:`docker.errors.NotFound`
if no config with that ID ex... |
Remove a config
Args:
id (string): Full ID of the config to remove
Returns (boolean): True if successful
Raises:
:py:class:`docker.errors.NotFound`
if no config with that ID exists
| remove_config | python | docker/docker-py | docker/api/config.py | https://github.com/docker/docker-py/blob/master/docker/api/config.py | Apache-2.0 |
def configs(self, filters=None):
"""
List configs
Args:
filters (dict): A map of filters to process on the configs
list. Available filters: ``names``
Returns (list): A list of configs
"""
url = self._url('/configs')
pa... |
List configs
Args:
filters (dict): A map of filters to process on the configs
list. Available filters: ``names``
Returns (list): A list of configs
| configs | python | docker/docker-py | docker/api/config.py | https://github.com/docker/docker-py/blob/master/docker/api/config.py | Apache-2.0 |
def attach(self, container, stdout=True, stderr=True,
stream=False, logs=False, demux=False):
"""
Attach to a container.
The ``.logs()`` function is a wrapper around this method, which you can
use instead if you want to fetch/stream container output without first
... |
Attach to a container.
The ``.logs()`` function is a wrapper around this method, which you can
use instead if you want to fetch/stream container output without first
retrieving the entire backlog.
Args:
container (str): The container to attach to.
stdou... | attach | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def attach_socket(self, container, params=None, ws=False):
"""
Like ``attach``, but returns the underlying socket-like object for the
HTTP request.
Args:
container (str): The container to attach to.
params (dict): Dictionary of request parameters (e.g. ``stdout``... |
Like ``attach``, but returns the underlying socket-like object for the
HTTP request.
Args:
container (str): The container to attach to.
params (dict): Dictionary of request parameters (e.g. ``stdout``,
``stderr``, ``stream``).
For ``detac... | attach_socket | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def diff(self, container):
"""
Inspect changes on a container's filesystem.
Args:
container (str): The container to diff
Returns:
(list) A list of dictionaries containing the attributes `Path`
and `Kind`.
Raises:
:py:class:`d... |
Inspect changes on a container's filesystem.
Args:
container (str): The container to diff
Returns:
(list) A list of dictionaries containing the attributes `Path`
and `Kind`.
Raises:
:py:class:`docker.errors.APIError`
... | diff | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def export(self, container, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Export the contents of a filesystem as a tar archive.
Args:
container (str): The container to export
chunk_size (int): The number of bytes returned by each iteration
of the generator. If... |
Export the contents of a filesystem as a tar archive.
Args:
container (str): The container to export
chunk_size (int): The number of bytes returned by each iteration
of the generator. If ``None``, data will be streamed as it is
received. Default:... | export | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def get_archive(self, container, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE,
encode_stream=False):
"""
Retrieve a file or folder from a container in the form of a tar
archive.
Args:
container (str): The container where the file is located
path (... |
Retrieve a file or folder from a container in the form of a tar
archive.
Args:
container (str): The container where the file is located
path (str): Path to the file or folder to retrieve
chunk_size (int): The number of bytes returned by each iteration
... | get_archive | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def inspect_container(self, container):
"""
Identical to the `docker inspect` command, but only for containers.
Args:
container (str): The container to inspect
Returns:
(dict): Similar to the output of `docker inspect`, but as a
single dict
... |
Identical to the `docker inspect` command, but only for containers.
Args:
container (str): The container to inspect
Returns:
(dict): Similar to the output of `docker inspect`, but as a
single dict
Raises:
:py:class:`docker.errors.APIErr... | inspect_container | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def kill(self, container, signal=None):
"""
Kill a container or send a signal to a container.
Args:
container (str): The container to kill
signal (str or int): The signal to send. Defaults to ``SIGKILL``
Raises:
:py:class:`docker.errors.APIError`
... |
Kill a container or send a signal to a container.
Args:
container (str): The container to kill
signal (str or int): The signal to send. Defaults to ``SIGKILL``
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
... | kill | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def logs(self, container, stdout=True, stderr=True, stream=False,
timestamps=False, tail='all', since=None, follow=None,
until=None):
"""
Get logs from a container. Similar to the ``docker logs`` command.
The ``stream`` parameter makes the ``logs`` function return a bl... |
Get logs from a container. Similar to the ``docker logs`` command.
The ``stream`` parameter makes the ``logs`` function return a blocking
generator you can iterate over to retrieve log output as it happens.
Args:
container (str): The container to get logs from
... | logs | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def pause(self, container):
"""
Pauses all processes within a container.
Args:
container (str): The container to pause
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
url = self._url('/containers/{0}... |
Pauses all processes within a container.
Args:
container (str): The container to pause
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| pause | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def port(self, container, private_port):
"""
Lookup the public-facing port that is NAT-ed to ``private_port``.
Identical to the ``docker port`` command.
Args:
container (str): The container to look up
private_port (int): The private port to inspect
Retur... |
Lookup the public-facing port that is NAT-ed to ``private_port``.
Identical to the ``docker port`` command.
Args:
container (str): The container to look up
private_port (int): The private port to inspect
Returns:
(list of dict): The mapping for the ... | port | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def put_archive(self, container, path, data):
"""
Insert a file or folder in an existing container using a tar archive as
source.
Args:
container (str): The container where the file(s) will be extracted
path (str): Path inside the container where the file(s) will... |
Insert a file or folder in an existing container using a tar archive as
source.
Args:
container (str): The container where the file(s) will be extracted
path (str): Path inside the container where the file(s) will be
extracted. Must exist.
da... | put_archive | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def prune_containers(self, filters=None):
"""
Delete stopped containers
Args:
filters (dict): Filters to process on the prune list.
Returns:
(dict): A dict containing a list of deleted container IDs and
the amount of disk space reclaimed in bytes... |
Delete stopped containers
Args:
filters (dict): Filters to process on the prune list.
Returns:
(dict): A dict containing a list of deleted container IDs and
the amount of disk space reclaimed in bytes.
Raises:
:py:class:`docker.erro... | prune_containers | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def remove_container(self, container, v=False, link=False, force=False):
"""
Remove a container. Similar to the ``docker rm`` command.
Args:
container (str): The container to remove
v (bool): Remove the volumes associated with the container
link (bool): Remov... |
Remove a container. Similar to the ``docker rm`` command.
Args:
container (str): The container to remove
v (bool): Remove the volumes associated with the container
link (bool): Remove the specified link and not the underlying
container
fo... | remove_container | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def rename(self, container, name):
"""
Rename a container. Similar to the ``docker rename`` command.
Args:
container (str): ID of the container to rename
name (str): New name for the container
Raises:
:py:class:`docker.errors.APIError`
... |
Rename a container. Similar to the ``docker rename`` command.
Args:
container (str): ID of the container to rename
name (str): New name for the container
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| rename | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def resize(self, container, height, width):
"""
Resize the tty session.
Args:
container (str or dict): The container to resize
height (int): Height of tty session
width (int): Width of tty session
Raises:
:py:class:`docker.errors.APIError... |
Resize the tty session.
Args:
container (str or dict): The container to resize
height (int): Height of tty session
width (int): Width of tty session
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
... | resize | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def restart(self, container, timeout=10):
"""
Restart a container. Similar to the ``docker restart`` command.
Args:
container (str or dict): The container to restart. If a dict, the
``Id`` key is used.
timeout (int): Number of seconds to try to stop for b... |
Restart a container. Similar to the ``docker restart`` command.
Args:
container (str or dict): The container to restart. If a dict, the
``Id`` key is used.
timeout (int): Number of seconds to try to stop for before killing
the container. Once kil... | restart | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def start(self, container, *args, **kwargs):
"""
Start a container. Similar to the ``docker start`` command, but
doesn't support attach options.
**Deprecation warning:** Passing configuration options in ``start`` is
no longer supported. Users are expected to provide host config ... |
Start a container. Similar to the ``docker start`` command, but
doesn't support attach options.
**Deprecation warning:** Passing configuration options in ``start`` is
no longer supported. Users are expected to provide host config options
in the ``host_config`` parameter of
... | start | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def stats(self, container, decode=None, stream=True, one_shot=None):
"""
Stream statistics for a specific container. Similar to the
``docker stats`` command.
Args:
container (str): The container to stream statistics from
decode (bool): If set to true, stream will... |
Stream statistics for a specific container. Similar to the
``docker stats`` command.
Args:
container (str): The container to stream statistics from
decode (bool): If set to true, stream will be decoded into dicts
on the fly. Only applicable if ``stream``... | stats | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def stop(self, container, timeout=None):
"""
Stops a container. Similar to the ``docker stop`` command.
Args:
container (str): The container to stop
timeout (int): Timeout in seconds to wait for the container to
stop before sending a ``SIGKILL``. If None,... |
Stops a container. Similar to the ``docker stop`` command.
Args:
container (str): The container to stop
timeout (int): Timeout in seconds to wait for the container to
stop before sending a ``SIGKILL``. If None, then the
StopTimeout value of the c... | stop | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def top(self, container, ps_args=None):
"""
Display the running processes of a container.
Args:
container (str): The container to inspect
ps_args (str): An optional arguments passed to ps (e.g. ``aux``)
Returns:
(str): The output of the top
... |
Display the running processes of a container.
Args:
container (str): The container to inspect
ps_args (str): An optional arguments passed to ps (e.g. ``aux``)
Returns:
(str): The output of the top
Raises:
:py:class:`docker.errors.APIErr... | top | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def unpause(self, container):
"""
Unpause all processes within a container.
Args:
container (str): The container to unpause
"""
url = self._url('/containers/{0}/unpause', container)
res = self._post(url)
self._raise_for_status(res) |
Unpause all processes within a container.
Args:
container (str): The container to unpause
| unpause | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def wait(self, container, timeout=None, condition=None):
"""
Block until a container stops, then return its exit code. Similar to
the ``docker wait`` command.
Args:
container (str or dict): The container to wait on. If a dict, the
``Id`` key is used.
... |
Block until a container stops, then return its exit code. Similar to
the ``docker wait`` command.
Args:
container (str or dict): The container to wait on. If a dict, the
``Id`` key is used.
timeout (int): Request timeout
condition (str): Wait... | wait | python | docker/docker-py | docker/api/container.py | https://github.com/docker/docker-py/blob/master/docker/api/container.py | Apache-2.0 |
def df(self):
"""
Get data usage information.
Returns:
(dict): A dictionary representing different resource categories
and their respective data usage.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
... |
Get data usage information.
Returns:
(dict): A dictionary representing different resource categories
and their respective data usage.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| df | python | docker/docker-py | docker/api/daemon.py | https://github.com/docker/docker-py/blob/master/docker/api/daemon.py | Apache-2.0 |
def events(self, since=None, until=None, filters=None, decode=None):
"""
Get real-time events from the server. Similar to the ``docker events``
command.
Args:
since (UTC datetime or int): Get events from this point
until (UTC datetime or int): Get events until th... |
Get real-time events from the server. Similar to the ``docker events``
command.
Args:
since (UTC datetime or int): Get events from this point
until (UTC datetime or int): Get events until this point
filters (dict): Filter the events by event time, container ... | events | python | docker/docker-py | docker/api/daemon.py | https://github.com/docker/docker-py/blob/master/docker/api/daemon.py | Apache-2.0 |
def login(self, username, password=None, email=None, registry=None,
reauth=False, dockercfg_path=None):
"""
Authenticate with a registry. Similar to the ``docker login`` command.
Args:
username (str): The registry username
password (str): The plaintext pass... |
Authenticate with a registry. Similar to the ``docker login`` command.
Args:
username (str): The registry username
password (str): The plaintext password
email (str): The email for the registry account
registry (str): URL to the registry. E.g.
... | login | python | docker/docker-py | docker/api/daemon.py | https://github.com/docker/docker-py/blob/master/docker/api/daemon.py | Apache-2.0 |
def version(self, api_version=True):
"""
Returns version information from the server. Similar to the ``docker
version`` command.
Returns:
(dict): The server version information
Raises:
:py:class:`docker.errors.APIError`
If the server retu... |
Returns version information from the server. Similar to the ``docker
version`` command.
Returns:
(dict): The server version information
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| version | python | docker/docker-py | docker/api/daemon.py | https://github.com/docker/docker-py/blob/master/docker/api/daemon.py | Apache-2.0 |
def exec_create(self, container, cmd, stdout=True, stderr=True,
stdin=False, tty=False, privileged=False, user='',
environment=None, workdir=None, detach_keys=None):
"""
Sets up an exec instance in a running container.
Args:
container (str): T... |
Sets up an exec instance in a running container.
Args:
container (str): Target container where exec instance will be
created
cmd (str or list): Command to be executed
stdout (bool): Attach to stdout. Default: ``True``
stderr (bool): Attac... | exec_create | python | docker/docker-py | docker/api/exec_api.py | https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py | Apache-2.0 |
def exec_inspect(self, exec_id):
"""
Return low-level information about an exec command.
Args:
exec_id (str): ID of the exec instance
Returns:
(dict): Dictionary of values returned by the endpoint.
Raises:
:py:class:`docker.errors.APIError`
... |
Return low-level information about an exec command.
Args:
exec_id (str): ID of the exec instance
Returns:
(dict): Dictionary of values returned by the endpoint.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an err... | exec_inspect | python | docker/docker-py | docker/api/exec_api.py | https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py | Apache-2.0 |
def exec_resize(self, exec_id, height=None, width=None):
"""
Resize the tty session used by the specified exec command.
Args:
exec_id (str): ID of the exec instance
height (int): Height of tty session
width (int): Width of tty session
"""
if ... |
Resize the tty session used by the specified exec command.
Args:
exec_id (str): ID of the exec instance
height (int): Height of tty session
width (int): Width of tty session
| exec_resize | python | docker/docker-py | docker/api/exec_api.py | https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py | Apache-2.0 |
def exec_start(self, exec_id, detach=False, tty=False, stream=False,
socket=False, demux=False):
"""
Start a previously set up exec instance.
Args:
exec_id (str): ID of the exec instance
detach (bool): If true, detach from the exec command.
... |
Start a previously set up exec instance.
Args:
exec_id (str): ID of the exec instance
detach (bool): If true, detach from the exec command.
Default: False
tty (bool): Allocate a pseudo-TTY. Default: False
stream (bool): Return response da... | exec_start | python | docker/docker-py | docker/api/exec_api.py | https://github.com/docker/docker-py/blob/master/docker/api/exec_api.py | Apache-2.0 |
def get_image(self, image, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Get a tarball of an image. Similar to the ``docker save`` command.
Args:
image (str): Image name to get
chunk_size (int): The number of bytes returned by each iteration
of the generator. ... |
Get a tarball of an image. Similar to the ``docker save`` command.
Args:
image (str): Image name to get
chunk_size (int): The number of bytes returned by each iteration
of the generator. If ``None``, data will be streamed as it is
received. Defau... | get_image | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def history(self, image):
"""
Show the history of an image.
Args:
image (str): The image to show history for
Returns:
(list): The history of the image
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.... |
Show the history of an image.
Args:
image (str): The image to show history for
Returns:
(list): The history of the image
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| history | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def images(self, name=None, quiet=False, all=False, filters=None):
"""
List images. Similar to the ``docker images`` command.
Args:
name (str): Only show images belonging to the repository ``name``
quiet (bool): Only return numeric IDs as a list.
all (bool): ... |
List images. Similar to the ``docker images`` command.
Args:
name (str): Only show images belonging to the repository ``name``
quiet (bool): Only return numeric IDs as a list.
all (bool): Show intermediate image layers. By default, these are
filtered... | images | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def import_image(self, src=None, repository=None, tag=None, image=None,
changes=None, stream_src=False):
"""
Import an image. Similar to the ``docker import`` command.
If ``src`` is a string or unicode string, it will first be treated as a
path to a tarball on the l... |
Import an image. Similar to the ``docker import`` command.
If ``src`` is a string or unicode string, it will first be treated as a
path to a tarball on the local system. If there is an error reading
from that file, ``src`` will be treated as a URL instead to fetch the
image fro... | import_image | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def import_image_from_data(self, data, repository=None, tag=None,
changes=None):
"""
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but
allows importing in-memory bytes data.
Args:
data (bytes collection): Bytes collection contai... |
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but
allows importing in-memory bytes data.
Args:
data (bytes collection): Bytes collection containing valid tar data
repository (str): The repository to create
tag (str): The tag to apply
| import_image_from_data | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def import_image_from_file(self, filename, repository=None, tag=None,
changes=None):
"""
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but only
supports importing from a tar file on disk.
Args:
filename (str): Full path to a tar... |
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but only
supports importing from a tar file on disk.
Args:
filename (str): Full path to a tar file.
repository (str): The repository to create
tag (str): The tag to apply
Raises:
... | import_image_from_file | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def import_image_from_url(self, url, repository=None, tag=None,
changes=None):
"""
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but only
supports importing from a URL.
Args:
url (str): A URL pointing to a tar file.
r... |
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but only
supports importing from a URL.
Args:
url (str): A URL pointing to a tar file.
repository (str): The repository to create
tag (str): The tag to apply
| import_image_from_url | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def import_image_from_image(self, image, repository=None, tag=None,
changes=None):
"""
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but only
supports importing from another image, like the ``FROM`` Dockerfile
parameter.
Args:
... |
Like :py:meth:`~docker.api.image.ImageApiMixin.import_image`, but only
supports importing from another image, like the ``FROM`` Dockerfile
parameter.
Args:
image (str): Image name to import from
repository (str): The repository to create
tag (str): T... | import_image_from_image | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def inspect_image(self, image):
"""
Get detailed information about an image. Similar to the ``docker
inspect`` command, but only for images.
Args:
image (str): The image to inspect
Returns:
(dict): Similar to the output of ``docker inspect``, but as a
... |
Get detailed information about an image. Similar to the ``docker
inspect`` command, but only for images.
Args:
image (str): The image to inspect
Returns:
(dict): Similar to the output of ``docker inspect``, but as a
single dict
Raises:
... | inspect_image | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def inspect_distribution(self, image, auth_config=None):
"""
Get image digest and platform information by contacting the registry.
Args:
image (str): The image name to inspect
auth_config (dict): Override the credentials that are found in the
config for t... |
Get image digest and platform information by contacting the registry.
Args:
image (str): The image name to inspect
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``u... | inspect_distribution | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def load_image(self, data, quiet=None):
"""
Load an image that was previously saved using
:py:meth:`~docker.api.image.ImageApiMixin.get_image` (or ``docker
save``). Similar to ``docker load``.
Args:
data (binary): Image data to be loaded.
quiet (boolean):... |
Load an image that was previously saved using
:py:meth:`~docker.api.image.ImageApiMixin.get_image` (or ``docker
save``). Similar to ``docker load``.
Args:
data (binary): Image data to be loaded.
quiet (boolean): Suppress progress details in response.
Re... | load_image | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def prune_images(self, filters=None):
"""
Delete unused images
Args:
filters (dict): Filters to process on the prune list.
Available filters:
- dangling (bool): When set to true (or 1), prune only
unused and untagged images.
... |
Delete unused images
Args:
filters (dict): Filters to process on the prune list.
Available filters:
- dangling (bool): When set to true (or 1), prune only
unused and untagged images.
Returns:
(dict): A dict containing a ... | prune_images | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def pull(self, repository, tag=None, stream=False, auth_config=None,
decode=False, platform=None, all_tags=False):
"""
Pulls an image. Similar to the ``docker pull`` command.
Args:
repository (str): The repository to pull
tag (str): The tag to pull. If ``tag... |
Pulls an image. Similar to the ``docker pull`` command.
Args:
repository (str): The repository to pull
tag (str): The tag to pull. If ``tag`` is ``None`` or empty, it
is set to ``latest``.
stream (bool): Stream the output as a generator. Make sure to... | pull | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def push(self, repository, tag=None, stream=False, auth_config=None,
decode=False):
"""
Push an image or a repository to the registry. Similar to the ``docker
push`` command.
Args:
repository (str): The repository to push to
tag (str): An optional ta... |
Push an image or a repository to the registry. Similar to the ``docker
push`` command.
Args:
repository (str): The repository to push to
tag (str): An optional tag to push
stream (bool): Stream the output as a blocking generator
auth_config (dict... | push | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def remove_image(self, image, force=False, noprune=False):
"""
Remove an image. Similar to the ``docker rmi`` command.
Args:
image (str): The image to remove
force (bool): Force removal of the image
noprune (bool): Do not delete untagged parents
"""
... |
Remove an image. Similar to the ``docker rmi`` command.
Args:
image (str): The image to remove
force (bool): Force removal of the image
noprune (bool): Do not delete untagged parents
| remove_image | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def tag(self, image, repository, tag=None, force=False):
"""
Tag an image into a repository. Similar to the ``docker tag`` command.
Args:
image (str): The image to tag
repository (str): The repository to set for the tag
tag (str): The tag name
for... |
Tag an image into a repository. Similar to the ``docker tag`` command.
Args:
image (str): The image to tag
repository (str): The repository to set for the tag
tag (str): The tag name
force (bool): Force
Returns:
(bool): ``True`` if s... | tag | python | docker/docker-py | docker/api/image.py | https://github.com/docker/docker-py/blob/master/docker/api/image.py | Apache-2.0 |
def networks(self, names=None, ids=None, filters=None):
"""
List networks. Similar to the ``docker network ls`` command.
Args:
names (:py:class:`list`): List of names to filter by
ids (:py:class:`list`): List of ids to filter by
filters (dict): Filters to be ... |
List networks. Similar to the ``docker network ls`` command.
Args:
names (:py:class:`list`): List of names to filter by
ids (:py:class:`list`): List of ids to filter by
filters (dict): Filters to be processed on the network list.
Available filters:
... | networks | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def create_network(self, name, driver=None, options=None, ipam=None,
check_duplicate=None, internal=False, labels=None,
enable_ipv6=False, attachable=None, scope=None,
ingress=None):
"""
Create a network. Similar to the ``docker networ... |
Create a network. Similar to the ``docker network create``.
Args:
name (str): Name of the network
driver (str): Name of the driver used to create the network
options (dict): Driver options as a key-value dictionary
ipam (IPAMConfig): Optional custom IP s... | create_network | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def prune_networks(self, filters=None):
"""
Delete unused networks
Args:
filters (dict): Filters to process on the prune list.
Returns:
(dict): A dict containing a list of deleted network names and
the amount of disk space reclaimed in bytes.
... |
Delete unused networks
Args:
filters (dict): Filters to process on the prune list.
Returns:
(dict): A dict containing a list of deleted network names and
the amount of disk space reclaimed in bytes.
Raises:
:py:class:`docker.errors.... | prune_networks | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def remove_network(self, net_id):
"""
Remove a network. Similar to the ``docker network rm`` command.
Args:
net_id (str): The network's id
"""
url = self._url("/networks/{0}", net_id)
res = self._delete(url)
self._raise_for_status(res) |
Remove a network. Similar to the ``docker network rm`` command.
Args:
net_id (str): The network's id
| remove_network | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def inspect_network(self, net_id, verbose=None, scope=None):
"""
Get detailed information about a network.
Args:
net_id (str): ID of network
verbose (bool): Show the service details across the cluster in
swarm mode.
scope (str): Filter the net... |
Get detailed information about a network.
Args:
net_id (str): ID of network
verbose (bool): Show the service details across the cluster in
swarm mode.
scope (str): Filter the network by scope (``swarm``, ``global``
or ``local``).
... | inspect_network | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def connect_container_to_network(self, container, net_id,
ipv4_address=None, ipv6_address=None,
aliases=None, links=None,
link_local_ips=None, driver_opt=None,
mac_address=... |
Connect a container to a network.
Args:
container (str): container-id/name to be connected to the network
net_id (str): network id
aliases (:py:class:`list`): A list of aliases for this endpoint.
Names in that list can be used within the network to r... | connect_container_to_network | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def disconnect_container_from_network(self, container, net_id,
force=False):
"""
Disconnect a container from a network.
Args:
container (str): container ID or name to be disconnected from the
network
net_id (str):... |
Disconnect a container from a network.
Args:
container (str): container ID or name to be disconnected from the
network
net_id (str): network ID
force (bool): Force the container to disconnect from a network.
Default: ``False``
... | disconnect_container_from_network | python | docker/docker-py | docker/api/network.py | https://github.com/docker/docker-py/blob/master/docker/api/network.py | Apache-2.0 |
def plugins(self):
"""
Retrieve a list of installed plugins.
Returns:
A list of dicts, one per plugin
"""
url = self._url('/plugins')
return self._result(self._get(url), True) |
Retrieve a list of installed plugins.
Returns:
A list of dicts, one per plugin
| plugins | python | docker/docker-py | docker/api/plugin.py | https://github.com/docker/docker-py/blob/master/docker/api/plugin.py | Apache-2.0 |
def create_secret(self, name, data, labels=None, driver=None):
"""
Create a secret
Args:
name (string): Name of the secret
data (bytes): Secret data to be stored
labels (dict): A mapping of labels to assign to the secret
dr... |
Create a secret
Args:
name (string): Name of the secret
data (bytes): Secret data to be stored
labels (dict): A mapping of labels to assign to the secret
driver (DriverConfig): A custom driver configuration. If
... | create_secret | python | docker/docker-py | docker/api/secret.py | https://github.com/docker/docker-py/blob/master/docker/api/secret.py | Apache-2.0 |
def inspect_secret(self, id):
"""
Retrieve secret metadata
Args:
id (string): Full ID of the secret to inspect
Returns (dict): A dictionary of metadata
Raises:
:py:class:`docker.errors.NotFound`
if no secret w... |
Retrieve secret metadata
Args:
id (string): Full ID of the secret to inspect
Returns (dict): A dictionary of metadata
Raises:
:py:class:`docker.errors.NotFound`
if no secret with that ID exists
| inspect_secret | python | docker/docker-py | docker/api/secret.py | https://github.com/docker/docker-py/blob/master/docker/api/secret.py | Apache-2.0 |
def remove_secret(self, id):
"""
Remove a secret
Args:
id (string): Full ID of the secret to remove
Returns (boolean): True if successful
Raises:
:py:class:`docker.errors.NotFound`
if no secret with that ID ex... |
Remove a secret
Args:
id (string): Full ID of the secret to remove
Returns (boolean): True if successful
Raises:
:py:class:`docker.errors.NotFound`
if no secret with that ID exists
| remove_secret | python | docker/docker-py | docker/api/secret.py | https://github.com/docker/docker-py/blob/master/docker/api/secret.py | Apache-2.0 |
def secrets(self, filters=None):
"""
List secrets
Args:
filters (dict): A map of filters to process on the secrets
list. Available filters: ``names``
Returns (list): A list of secrets
"""
url = self._url('/secrets')
pa... |
List secrets
Args:
filters (dict): A map of filters to process on the secrets
list. Available filters: ``names``
Returns (list): A list of secrets
| secrets | python | docker/docker-py | docker/api/secret.py | https://github.com/docker/docker-py/blob/master/docker/api/secret.py | Apache-2.0 |
def create_service(
self, task_template, name=None, labels=None, mode=None,
update_config=None, networks=None, endpoint_config=None,
endpoint_spec=None, rollback_config=None
):
"""
Create a service.
Args:
task_template (TaskTemplate): Specific... |
Create a service.
Args:
task_template (TaskTemplate): Specification of the task to start as
part of the new service.
name (string): User-defined name for the service. Optional.
labels (dict): A map of labels to associate with the service.
... | create_service | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def inspect_service(self, service, insert_defaults=None):
"""
Return information about a service.
Args:
service (str): Service name or ID.
insert_defaults (boolean): If true, default values will be merged
into the service inspect output.
Returns:... |
Return information about a service.
Args:
service (str): Service name or ID.
insert_defaults (boolean): If true, default values will be merged
into the service inspect output.
Returns:
(dict): A dictionary of the server-side representation o... | inspect_service | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def inspect_task(self, task):
"""
Retrieve information about a task.
Args:
task (str): Task ID
Returns:
(dict): Information about the task.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
""... |
Retrieve information about a task.
Args:
task (str): Task ID
Returns:
(dict): Information about the task.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| inspect_task | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def remove_service(self, service):
"""
Stop and remove a service.
Args:
service (str): Service name or ID
Returns:
``True`` if successful.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""... |
Stop and remove a service.
Args:
service (str): Service name or ID
Returns:
``True`` if successful.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| remove_service | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def services(self, filters=None, status=None):
"""
List services.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name`` , ``label`` and ``mode``.
Default: ``None``.
status (bool): Include the service t... |
List services.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name`` , ``label`` and ``mode``.
Default: ``None``.
status (bool): Include the service task count of running and
desired tasks. De... | services | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def tasks(self, filters=None):
"""
Retrieve a list of tasks.
Args:
filters (dict): A map of filters to process on the tasks list.
Valid filters: ``id``, ``name``, ``service``, ``node``,
``label`` and ``desired-state``.
Returns:
(:... |
Retrieve a list of tasks.
Args:
filters (dict): A map of filters to process on the tasks list.
Valid filters: ``id``, ``name``, ``service``, ``node``,
``label`` and ``desired-state``.
Returns:
(:py:class:`list`): List of task dictionarie... | tasks | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def update_service(self, service, version, task_template=None, name=None,
labels=None, mode=None, update_config=None,
networks=None, endpoint_config=None,
endpoint_spec=None, fetch_current_spec=False,
rollback_config=None):
... |
Update a service.
Args:
service (string): A service identifier (either its name or service
ID).
version (int): The version number of the service object being
updated. This is required to avoid conflicting writes.
task_template (TaskTe... | update_service | python | docker/docker-py | docker/api/service.py | https://github.com/docker/docker-py/blob/master/docker/api/service.py | Apache-2.0 |
def inspect_swarm(self):
"""
Retrieve low-level information about the current swarm.
Returns:
A dictionary containing data about the swarm.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
url = self.... |
Retrieve low-level information about the current swarm.
Returns:
A dictionary containing data about the swarm.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| inspect_swarm | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def inspect_node(self, node_id):
"""
Retrieve low-level information about a swarm node
Args:
node_id (string): ID of the node to be inspected.
Returns:
A dictionary containing data about this node.
Raises:
:py:class:`docker.errors.APIError`
... |
Retrieve low-level information about a swarm node
Args:
node_id (string): ID of the node to be inspected.
Returns:
A dictionary containing data about this node.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an err... | inspect_node | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def leave_swarm(self, force=False):
"""
Leave a swarm.
Args:
force (bool): Leave the swarm even if this node is a manager.
Default: ``False``
Returns:
``True`` if the request went through.
Raises:
:py:class:`docker.errors.API... |
Leave a swarm.
Args:
force (bool): Leave the swarm even if this node is a manager.
Default: ``False``
Returns:
``True`` if the request went through.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an... | leave_swarm | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def nodes(self, filters=None):
"""
List swarm nodes.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name``, ``membership`` and ``role``.
Default: ``None``
Returns:
A list of dictionaries conta... |
List swarm nodes.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name``, ``membership`` and ``role``.
Default: ``None``
Returns:
A list of dictionaries containing data about each swarm node.
... | nodes | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def remove_node(self, node_id, force=False):
"""
Remove a node from the swarm.
Args:
node_id (string): ID of the node to be removed.
force (bool): Force remove an active node. Default: `False`
Raises:
:py:class:`docker.errors.NotFound`
... |
Remove a node from the swarm.
Args:
node_id (string): ID of the node to be removed.
force (bool): Force remove an active node. Default: `False`
Raises:
:py:class:`docker.errors.NotFound`
If the node referenced doesn't exist in the swarm.
... | remove_node | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def unlock_swarm(self, key):
"""
Unlock a locked swarm.
Args:
key (string): The unlock key as provided by
:py:meth:`get_unlock_key`
Raises:
:py:class:`docker.errors.InvalidArgument`
If the key argument ... |
Unlock a locked swarm.
Args:
key (string): The unlock key as provided by
:py:meth:`get_unlock_key`
Raises:
:py:class:`docker.errors.InvalidArgument`
If the key argument is in an incompatible format
... | unlock_swarm | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def update_node(self, node_id, version, node_spec=None):
"""
Update the node's configuration
Args:
node_id (string): ID of the node to be updated.
version (int): The version number of the node object being
updated. This is required to avoid conflicting w... |
Update the node's configuration
Args:
node_id (string): ID of the node to be updated.
version (int): The version number of the node object being
updated. This is required to avoid conflicting writes.
node_spec (dict): Configuration settings to updat... | update_node | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def update_swarm(self, version, swarm_spec=None,
rotate_worker_token=False,
rotate_manager_token=False,
rotate_manager_unlock_key=False):
"""
Update the Swarm's configuration
Args:
version (int): The version number of th... |
Update the Swarm's configuration
Args:
version (int): The version number of the swarm object being
updated. This is required to avoid conflicting writes.
swarm_spec (dict): Configuration settings to update. Use
:py:meth:`~docker.api.swarm.SwarmAp... | update_swarm | python | docker/docker-py | docker/api/swarm.py | https://github.com/docker/docker-py/blob/master/docker/api/swarm.py | Apache-2.0 |
def volumes(self, filters=None):
"""
List volumes currently registered by the docker daemon. Similar to the
``docker volume ls`` command.
Args:
filters (dict): Server-side list filtering options.
Returns:
(dict): Dictionary with list of volume objects as... |
List volumes currently registered by the docker daemon. Similar to the
``docker volume ls`` command.
Args:
filters (dict): Server-side list filtering options.
Returns:
(dict): Dictionary with list of volume objects as value of the
``Volumes`` key.
... | volumes | python | docker/docker-py | docker/api/volume.py | https://github.com/docker/docker-py/blob/master/docker/api/volume.py | Apache-2.0 |
def create_volume(self, name=None, driver=None, driver_opts=None,
labels=None):
"""
Create and register a named volume
Args:
name (str): Name of the volume
driver (str): Name of the driver used to create the volume
driver_opts (dict): Dr... |
Create and register a named volume
Args:
name (str): Name of the volume
driver (str): Name of the driver used to create the volume
driver_opts (dict): Driver options as a key-value dictionary
labels (dict): Labels to set on the volume
Returns:
... | create_volume | python | docker/docker-py | docker/api/volume.py | https://github.com/docker/docker-py/blob/master/docker/api/volume.py | Apache-2.0 |
def inspect_volume(self, name):
"""
Retrieve volume info by name.
Args:
name (str): volume name
Returns:
(dict): Volume information dictionary
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
... |
Retrieve volume info by name.
Args:
name (str): volume name
Returns:
(dict): Volume information dictionary
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
Example:
>>> client.api.insp... | inspect_volume | python | docker/docker-py | docker/api/volume.py | https://github.com/docker/docker-py/blob/master/docker/api/volume.py | Apache-2.0 |
def prune_volumes(self, filters=None):
"""
Delete unused volumes
Args:
filters (dict): Filters to process on the prune list.
Returns:
(dict): A dict containing a list of deleted volume names and
the amount of disk space reclaimed in bytes.
... |
Delete unused volumes
Args:
filters (dict): Filters to process on the prune list.
Returns:
(dict): A dict containing a list of deleted volume names and
the amount of disk space reclaimed in bytes.
Raises:
:py:class:`docker.errors.AP... | prune_volumes | python | docker/docker-py | docker/api/volume.py | https://github.com/docker/docker-py/blob/master/docker/api/volume.py | Apache-2.0 |
def remove_volume(self, name, force=False):
"""
Remove a volume. Similar to the ``docker volume rm`` command.
Args:
name (str): The volume's name
force (bool): Force removal of volumes that were already removed
out of band by the volume driver plugin.
... |
Remove a volume. Similar to the ``docker volume rm`` command.
Args:
name (str): The volume's name
force (bool): Force removal of volumes that were already removed
out of band by the volume driver plugin.
Raises:
:py:class:`docker.errors.APIE... | remove_volume | python | docker/docker-py | docker/api/volume.py | https://github.com/docker/docker-py/blob/master/docker/api/volume.py | Apache-2.0 |
def create_context(
cls, name, orchestrator=None, host=None, tls_cfg=None,
default_namespace=None, skip_tls_verify=False):
"""Creates a new context.
Returns:
(Context): a Context object.
Raises:
:py:class:`docker.errors.MissingContextParameter`
... | Creates a new context.
Returns:
(Context): a Context object.
Raises:
:py:class:`docker.errors.MissingContextParameter`
If a context name is not provided.
:py:class:`docker.errors.ContextAlreadyExists`
If a context with the name already ... | create_context | python | docker/docker-py | docker/context/api.py | https://github.com/docker/docker-py/blob/master/docker/context/api.py | Apache-2.0 |
def get_context(cls, name=None):
"""Retrieves a context object.
Args:
name (str): The name of the context
Example:
>>> from docker.context import ContextAPI
>>> ctx = ContextAPI.get_context(name='test')
>>> print(ctx.Metadata)
{
"Name": "... | Retrieves a context object.
Args:
name (str): The name of the context
Example:
>>> from docker.context import ContextAPI
>>> ctx = ContextAPI.get_context(name='test')
>>> print(ctx.Metadata)
{
"Name": "test",
"Metadata": {},
... | get_context | python | docker/docker-py | docker/context/api.py | https://github.com/docker/docker-py/blob/master/docker/context/api.py | Apache-2.0 |
def contexts(cls):
"""Context list.
Returns:
(Context): List of context objects.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
names = []
for dirname, dirnames, fnames in os.walk(get_meta_dir()):
... | Context list.
Returns:
(Context): List of context objects.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
| contexts | python | docker/docker-py | docker/context/api.py | https://github.com/docker/docker-py/blob/master/docker/context/api.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.