partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | ContainerApiMixin.create_container | Creates a container. Parameters are similar to those for the ``docker
run`` command except it doesn't support the attach options (``-a``).
The arguments that are passed directly to this function are
host-independent configuration options. Host-specific configuration
is passed with the `... | docker/api/container.py | def create_container(self, image, command=None, hostname=None, user=None,
detach=False, stdin_open=False, tty=False, ports=None,
environment=None, volumes=None,
network_disabled=False, name=None, entrypoint=None,
working... | def create_container(self, image, command=None, hostname=None, user=None,
detach=False, stdin_open=False, tty=False, ports=None,
environment=None, volumes=None,
network_disabled=False, name=None, entrypoint=None,
working... | [
"Creates",
"a",
"container",
".",
"Parameters",
"are",
"similar",
"to",
"those",
"for",
"the",
"docker",
"run",
"command",
"except",
"it",
"doesn",
"t",
"support",
"the",
"attach",
"options",
"(",
"-",
"a",
")",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L217-L427 | [
"def",
"create_container",
"(",
"self",
",",
"image",
",",
"command",
"=",
"None",
",",
"hostname",
"=",
"None",
",",
"user",
"=",
"None",
",",
"detach",
"=",
"False",
",",
"stdin_open",
"=",
"False",
",",
"tty",
"=",
"False",
",",
"ports",
"=",
"Non... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.create_host_config | Create a dictionary for the ``host_config`` argument to
:py:meth:`create_container`.
Args:
auto_remove (bool): enable auto-removal of the container on daemon
side when the container's process exits.
binds (dict): Volumes to bind. See :py:meth:`create_container`
... | docker/api/container.py | def create_host_config(self, *args, **kwargs):
"""
Create a dictionary for the ``host_config`` argument to
:py:meth:`create_container`.
Args:
auto_remove (bool): enable auto-removal of the container on daemon
side when the container's process exits.
... | def create_host_config(self, *args, **kwargs):
"""
Create a dictionary for the ``host_config`` argument to
:py:meth:`create_container`.
Args:
auto_remove (bool): enable auto-removal of the container on daemon
side when the container's process exits.
... | [
"Create",
"a",
"dictionary",
"for",
"the",
"host_config",
"argument",
"to",
":",
"py",
":",
"meth",
":",
"create_container",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L440-L589 | [
"def",
"create_host_config",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"kwargs",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'version'",
"in",
"kwargs",
":",
"raise",
"TypeError",
"(",
"\"create_host_config() got an unexpected \... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.diff | Inspect changes on a container's filesystem.
Args:
container (str): The container to diff
Returns:
(str)
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/api/container.py | def diff(self, container):
"""
Inspect changes on a container's filesystem.
Args:
container (str): The container to diff
Returns:
(str)
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
... | def diff(self, container):
"""
Inspect changes on a container's filesystem.
Args:
container (str): The container to diff
Returns:
(str)
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
... | [
"Inspect",
"changes",
"on",
"a",
"container",
"s",
"filesystem",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L652-L668 | [
"def",
"diff",
"(",
"self",
",",
"container",
")",
":",
"return",
"self",
".",
"_result",
"(",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
"\"/containers/{0}/changes\"",
",",
"container",
")",
")",
",",
"True",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.export | 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: 2 MB
... | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L671-L691 | [
"def",
"export",
"(",
"self",
",",
"container",
",",
"chunk_size",
"=",
"DEFAULT_DATA_CHUNK_SIZE",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
"\"/containers/{0}/export\"",
",",
"container",
")",
",",
"stream",
"=",
"True",
")... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.get_archive | 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
... | docker/api/container.py | def get_archive(self, container, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
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 retri... | def get_archive(self, container, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
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 retri... | [
"Retrieve",
"a",
"file",
"or",
"folder",
"from",
"a",
"container",
"in",
"the",
"form",
"of",
"a",
"tar",
"archive",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L694-L736 | [
"def",
"get_archive",
"(",
"self",
",",
"container",
",",
"path",
",",
"chunk_size",
"=",
"DEFAULT_DATA_CHUNK_SIZE",
")",
":",
"params",
"=",
"{",
"'path'",
":",
"path",
"}",
"url",
"=",
"self",
".",
"_url",
"(",
"'/containers/{0}/archive'",
",",
"container"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.inspect_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
Raises:
:py:class:`docker.errors.APIError`
... | docker/api/container.py | 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
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L739-L756 | [
"def",
"inspect_container",
"(",
"self",
",",
"container",
")",
":",
"return",
"self",
".",
"_result",
"(",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
"\"/containers/{0}/json\"",
",",
"container",
")",
")",
",",
"True",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.kill | 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. | docker/api/container.py | 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`
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L759-L779 | [
"def",
"kill",
"(",
"self",
",",
"container",
",",
"signal",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/kill\"",
",",
"container",
")",
"params",
"=",
"{",
"}",
"if",
"signal",
"is",
"not",
"None",
":",
"if",
"not... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.logs | 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
stdout (b... | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L782-L857 | [
"def",
"logs",
"(",
"self",
",",
"container",
",",
"stdout",
"=",
"True",
",",
"stderr",
"=",
"True",
",",
"stream",
"=",
"False",
",",
"timestamps",
"=",
"False",
",",
"tail",
"=",
"'all'",
",",
"since",
"=",
"None",
",",
"follow",
"=",
"None",
",... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.pause | 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. | docker/api/container.py | 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}... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L860-L873 | [
"def",
"pause",
"(",
"self",
",",
"container",
")",
":",
"url",
"=",
"self",
".",
"_url",
"(",
"'/containers/{0}/pause'",
",",
"container",
")",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
")",
"self",
".",
"_raise_for_status",
"(",
"res",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.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
Returns:
(list of dict): The mapping for the host port... | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L876-L923 | [
"def",
"port",
"(",
"self",
",",
"container",
",",
"private_port",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
"\"/containers/{0}/json\"",
",",
"container",
")",
")",
"self",
".",
"_raise_for_status",
"(",
"res",
")",
"json_... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.put_archive | 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.
data (bytes... | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L926-L948 | [
"def",
"put_archive",
"(",
"self",
",",
"container",
",",
"path",
",",
"data",
")",
":",
"params",
"=",
"{",
"'path'",
":",
"path",
"}",
"url",
"=",
"self",
".",
"_url",
"(",
"'/containers/{0}/archive'",
",",
"container",
")",
"res",
"=",
"self",
".",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.remove_container | 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
force (bool... | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L973-L993 | [
"def",
"remove_container",
"(",
"self",
",",
"container",
",",
"v",
"=",
"False",
",",
"link",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'v'",
":",
"v",
",",
"'link'",
":",
"link",
",",
"'force'",
":",
"force",
"}",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.rename | 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. | docker/api/container.py | 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`
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L996-L1011 | [
"def",
"rename",
"(",
"self",
",",
"container",
",",
"name",
")",
":",
"url",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/rename\"",
",",
"container",
")",
"params",
"=",
"{",
"'name'",
":",
"name",
"}",
"res",
"=",
"self",
".",
"_post",
"(",
"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.resize | 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. | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1014-L1030 | [
"def",
"resize",
"(",
"self",
",",
"container",
",",
"height",
",",
"width",
")",
":",
"params",
"=",
"{",
"'h'",
":",
"height",
",",
"'w'",
":",
"width",
"}",
"url",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/resize\"",
",",
"container",
")",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.restart | 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 killed it wi... | docker/api/container.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1033-L1054 | [
"def",
"restart",
"(",
"self",
",",
"container",
",",
"timeout",
"=",
"10",
")",
":",
"params",
"=",
"{",
"'t'",
":",
"timeout",
"}",
"url",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/restart\"",
",",
"container",
")",
"conn_timeout",
"=",
"self",... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.start | 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
:py:m... | docker/api/container.py | 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 ... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1057-L1092 | [
"def",
"start",
"(",
"self",
",",
"container",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"or",
"kwargs",
":",
"raise",
"errors",
".",
"DeprecatedMethod",
"(",
"'Providing configuration in the start() method is no longer '",
"'supported. Us... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.stats | 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`` is True.... | docker/api/container.py | def stats(self, container, decode=None, stream=True):
"""
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 int... | def stats(self, container, decode=None, stream=True):
"""
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 int... | [
"Stream",
"statistics",
"for",
"a",
"specific",
"container",
".",
"Similar",
"to",
"the",
"docker",
"stats",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1095-L1123 | [
"def",
"stats",
"(",
"self",
",",
"container",
",",
"decode",
"=",
"None",
",",
"stream",
"=",
"True",
")",
":",
"url",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/stats\"",
",",
"container",
")",
"if",
"stream",
":",
"return",
"self",
".",
"_str... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.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.APIError`
... | docker/api/container.py | 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
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1154-L1173 | [
"def",
"top",
"(",
"self",
",",
"container",
",",
"ps_args",
"=",
"None",
")",
":",
"u",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/top\"",
",",
"container",
")",
"params",
"=",
"{",
"}",
"if",
"ps_args",
"is",
"not",
"None",
":",
"params",
"[... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.unpause | Unpause all processes within a container.
Args:
container (str): The container to unpause | docker/api/container.py | 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) | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1176-L1185 | [
"def",
"unpause",
"(",
"self",
",",
"container",
")",
":",
"url",
"=",
"self",
".",
"_url",
"(",
"'/containers/{0}/unpause'",
",",
"container",
")",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
")",
"self",
".",
"_raise_for_status",
"(",
"res",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.update_container | Update resource configs of one or more containers.
Args:
container (str): The container to inspect
blkio_weight (int): Block IO (relative weight), between 10 and 1000
cpu_period (int): Limit CPU CFS (Completely Fair Scheduler) period
cpu_quota (int): Limit CPU CF... | docker/api/container.py | def update_container(
self, container, blkio_weight=None, cpu_period=None, cpu_quota=None,
cpu_shares=None, cpuset_cpus=None, cpuset_mems=None, mem_limit=None,
mem_reservation=None, memswap_limit=None, kernel_memory=None,
restart_policy=None
):
"""
Update resource con... | def update_container(
self, container, blkio_weight=None, cpu_period=None, cpu_quota=None,
cpu_shares=None, cpuset_cpus=None, cpuset_mems=None, mem_limit=None,
mem_reservation=None, memswap_limit=None, kernel_memory=None,
restart_policy=None
):
"""
Update resource con... | [
"Update",
"resource",
"configs",
"of",
"one",
"or",
"more",
"containers",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1189-L1251 | [
"def",
"update_container",
"(",
"self",
",",
"container",
",",
"blkio_weight",
"=",
"None",
",",
"cpu_period",
"=",
"None",
",",
"cpu_quota",
"=",
"None",
",",
"cpu_shares",
"=",
"None",
",",
"cpuset_cpus",
"=",
"None",
",",
"cpuset_mems",
"=",
"None",
","... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerApiMixin.wait | 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 until a ... | docker/api/container.py | 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.
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/container.py#L1254-L1287 | [
"def",
"wait",
"(",
"self",
",",
"container",
",",
"timeout",
"=",
"None",
",",
"condition",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_url",
"(",
"\"/containers/{0}/wait\"",
",",
"container",
")",
"params",
"=",
"{",
"}",
"if",
"condition",
"is... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Image.tags | The image's tags. | docker/models/images.py | def tags(self):
"""
The image's tags.
"""
tags = self.attrs.get('RepoTags')
if tags is None:
tags = []
return [tag for tag in tags if tag != '<none>:<none>'] | def tags(self):
"""
The image's tags.
"""
tags = self.attrs.get('RepoTags')
if tags is None:
tags = []
return [tag for tag in tags if tag != '<none>:<none>'] | [
"The",
"image",
"s",
"tags",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L41-L48 | [
"def",
"tags",
"(",
"self",
")",
":",
"tags",
"=",
"self",
".",
"attrs",
".",
"get",
"(",
"'RepoTags'",
")",
"if",
"tags",
"is",
"None",
":",
"tags",
"=",
"[",
"]",
"return",
"[",
"tag",
"for",
"tag",
"in",
"tags",
"if",
"tag",
"!=",
"'<none>:<no... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Image.save | Get a tarball of an image. Similar to the ``docker save`` command.
Args:
chunk_size (int): The generator will return up to that much data
per iteration, but may return less. If ``None``, data will be
streamed as it is received. Default: 2 MB
named (str or... | docker/models/images.py | def save(self, chunk_size=DEFAULT_DATA_CHUNK_SIZE, named=False):
"""
Get a tarball of an image. Similar to the ``docker save`` command.
Args:
chunk_size (int): The generator will return up to that much data
per iteration, but may return less. If ``None``, data will b... | def save(self, chunk_size=DEFAULT_DATA_CHUNK_SIZE, named=False):
"""
Get a tarball of an image. Similar to the ``docker save`` command.
Args:
chunk_size (int): The generator will return up to that much data
per iteration, but may return less. If ``None``, data will b... | [
"Get",
"a",
"tarball",
"of",
"an",
"image",
".",
"Similar",
"to",
"the",
"docker",
"save",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L63-L103 | [
"def",
"save",
"(",
"self",
",",
"chunk_size",
"=",
"DEFAULT_DATA_CHUNK_SIZE",
",",
"named",
"=",
"False",
")",
":",
"img",
"=",
"self",
".",
"id",
"if",
"named",
":",
"img",
"=",
"self",
".",
"tags",
"[",
"0",
"]",
"if",
"self",
".",
"tags",
"else... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Image.tag | Tag this image into a repository. Similar to the ``docker tag``
command.
Args:
repository (str): The repository to set for the tag
tag (str): The tag name
force (bool): Force
Raises:
:py:class:`docker.errors.APIError`
If the serve... | docker/models/images.py | def tag(self, repository, tag=None, **kwargs):
"""
Tag this image into a repository. Similar to the ``docker tag``
command.
Args:
repository (str): The repository to set for the tag
tag (str): The tag name
force (bool): Force
Raises:
... | def tag(self, repository, tag=None, **kwargs):
"""
Tag this image into a repository. Similar to the ``docker tag``
command.
Args:
repository (str): The repository to set for the tag
tag (str): The tag name
force (bool): Force
Raises:
... | [
"Tag",
"this",
"image",
"into",
"a",
"repository",
".",
"Similar",
"to",
"the",
"docker",
"tag",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L105-L122 | [
"def",
"tag",
"(",
"self",
",",
"repository",
",",
"tag",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"tag",
"(",
"self",
".",
"id",
",",
"repository",
",",
"tag",
"=",
"tag",
",",
"*",
"*",... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | RegistryData.pull | Pull the image digest.
Args:
platform (str): The platform to pull the image for.
Default: ``None``
Returns:
(:py:class:`Image`): A reference to the pulled image. | docker/models/images.py | def pull(self, platform=None):
"""
Pull the image digest.
Args:
platform (str): The platform to pull the image for.
Default: ``None``
Returns:
(:py:class:`Image`): A reference to the pulled image.
"""
repository, _ = parse_repository_... | def pull(self, platform=None):
"""
Pull the image digest.
Args:
platform (str): The platform to pull the image for.
Default: ``None``
Returns:
(:py:class:`Image`): A reference to the pulled image.
"""
repository, _ = parse_repository_... | [
"Pull",
"the",
"image",
"digest",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L148-L160 | [
"def",
"pull",
"(",
"self",
",",
"platform",
"=",
"None",
")",
":",
"repository",
",",
"_",
"=",
"parse_repository_tag",
"(",
"self",
".",
"image_name",
")",
"return",
"self",
".",
"collection",
".",
"pull",
"(",
"repository",
",",
"tag",
"=",
"self",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | RegistryData.has_platform | Check whether the given platform identifier is available for this
digest.
Args:
platform (str or dict): A string using the ``os[/arch[/variant]]``
format, or a platform dictionary.
Returns:
(bool): ``True`` if the platform is recognized as available,
... | docker/models/images.py | def has_platform(self, platform):
"""
Check whether the given platform identifier is available for this
digest.
Args:
platform (str or dict): A string using the ``os[/arch[/variant]]``
format, or a platform dictionary.
Returns:
(bool): ``... | def has_platform(self, platform):
"""
Check whether the given platform identifier is available for this
digest.
Args:
platform (str or dict): A string using the ``os[/arch[/variant]]``
format, or a platform dictionary.
Returns:
(bool): ``... | [
"Check",
"whether",
"the",
"given",
"platform",
"identifier",
"is",
"available",
"for",
"this",
"digest",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L162-L192 | [
"def",
"has_platform",
"(",
"self",
",",
"platform",
")",
":",
"if",
"platform",
"and",
"not",
"isinstance",
"(",
"platform",
",",
"dict",
")",
":",
"parts",
"=",
"platform",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"parts",
")",
">",
"3",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ImageCollection.build | Build an image and return it. Similar to the ``docker build``
command. Either ``path`` or ``fileobj`` must be set.
If you have a tar file for the Docker build context (including a
Dockerfile) already, pass a readable file-like object to ``fileobj``
and also pass ``custom_context=True``.... | docker/models/images.py | def build(self, **kwargs):
"""
Build an image and return it. Similar to the ``docker build``
command. Either ``path`` or ``fileobj`` must be set.
If you have a tar file for the Docker build context (including a
Dockerfile) already, pass a readable file-like object to ``fileobj``... | def build(self, **kwargs):
"""
Build an image and return it. Similar to the ``docker build``
command. Either ``path`` or ``fileobj`` must be set.
If you have a tar file for the Docker build context (including a
Dockerfile) already, pass a readable file-like object to ``fileobj``... | [
"Build",
"an",
"image",
"and",
"return",
"it",
".",
"Similar",
"to",
"the",
"docker",
"build",
"command",
".",
"Either",
"path",
"or",
"fileobj",
"must",
"be",
"set",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L203-L298 | [
"def",
"build",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"build",
"(",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"resp",
",",
"six",
".",
"string_types",
")",
":",
"return",
"sel... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ImageCollection.get | Gets an image.
Args:
name (str): The name of the image.
Returns:
(:py:class:`Image`): The image.
Raises:
:py:class:`docker.errors.ImageNotFound`
If the image does not exist.
:py:class:`docker.errors.APIError`
If t... | docker/models/images.py | def get(self, name):
"""
Gets an image.
Args:
name (str): The name of the image.
Returns:
(:py:class:`Image`): The image.
Raises:
:py:class:`docker.errors.ImageNotFound`
If the image does not exist.
:py:class:`doc... | def get(self, name):
"""
Gets an image.
Args:
name (str): The name of the image.
Returns:
(:py:class:`Image`): The image.
Raises:
:py:class:`docker.errors.ImageNotFound`
If the image does not exist.
:py:class:`doc... | [
"Gets",
"an",
"image",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L300-L316 | [
"def",
"get",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"prepare_model",
"(",
"self",
".",
"client",
".",
"api",
".",
"inspect_image",
"(",
"name",
")",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ImageCollection.get_registry_data | Gets the registry data for an image.
Args:
name (str): The name of the image.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``username`` and ``password`` keys to be valid.
... | docker/models/images.py | def get_registry_data(self, name, auth_config=None):
"""
Gets the registry data for an image.
Args:
name (str): The name of the image.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should cont... | def get_registry_data(self, name, auth_config=None):
"""
Gets the registry data for an image.
Args:
name (str): The name of the image.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should cont... | [
"Gets",
"the",
"registry",
"data",
"for",
"an",
"image",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L318-L340 | [
"def",
"get_registry_data",
"(",
"self",
",",
"name",
",",
"auth_config",
"=",
"None",
")",
":",
"return",
"RegistryData",
"(",
"image_name",
"=",
"name",
",",
"attrs",
"=",
"self",
".",
"client",
".",
"api",
".",
"inspect_distribution",
"(",
"name",
",",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ImageCollection.list | List images on the server.
Args:
name (str): Only show images belonging to the repository ``name``
all (bool): Show intermediate image layers. By default, these are
filtered out.
filters (dict): Filters to be processed on the image list.
Avail... | docker/models/images.py | def list(self, name=None, all=False, filters=None):
"""
List images on the server.
Args:
name (str): Only show images belonging to the repository ``name``
all (bool): Show intermediate image layers. By default, these are
filtered out.
filters ... | def list(self, name=None, all=False, filters=None):
"""
List images on the server.
Args:
name (str): Only show images belonging to the repository ``name``
all (bool): Show intermediate image layers. By default, these are
filtered out.
filters ... | [
"List",
"images",
"on",
"the",
"server",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L342-L363 | [
"def",
"list",
"(",
"self",
",",
"name",
"=",
"None",
",",
"all",
"=",
"False",
",",
"filters",
"=",
"None",
")",
":",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"images",
"(",
"name",
"=",
"name",
",",
"all",
"=",
"all",
",",
"filter... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ImageCollection.load | Load an image that was previously saved using
:py:meth:`~docker.models.images.Image.save` (or ``docker save``).
Similar to ``docker load``.
Args:
data (binary): Image data to be loaded.
Returns:
(list of :py:class:`Image`): The images.
Raises:
... | docker/models/images.py | def load(self, data):
"""
Load an image that was previously saved using
:py:meth:`~docker.models.images.Image.save` (or ``docker save``).
Similar to ``docker load``.
Args:
data (binary): Image data to be loaded.
Returns:
(list of :py:class:`Image... | def load(self, data):
"""
Load an image that was previously saved using
:py:meth:`~docker.models.images.Image.save` (or ``docker save``).
Similar to ``docker load``.
Args:
data (binary): Image data to be loaded.
Returns:
(list of :py:class:`Image... | [
"Load",
"an",
"image",
"that",
"was",
"previously",
"saved",
"using",
":",
"py",
":",
"meth",
":",
"~docker",
".",
"models",
".",
"images",
".",
"Image",
".",
"save",
"(",
"or",
"docker",
"save",
")",
".",
"Similar",
"to",
"docker",
"load",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L365-L395 | [
"def",
"load",
"(",
"self",
",",
"data",
")",
":",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"load_image",
"(",
"data",
")",
"images",
"=",
"[",
"]",
"for",
"chunk",
"in",
"resp",
":",
"if",
"'stream'",
"in",
"chunk",
":",
"match",
"="... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ImageCollection.pull | Pull an image of the given name and return it. Similar to the
``docker pull`` command.
If no tag is specified, all tags from that repository will be
pulled.
If you want to get the raw pull output, use the
:py:meth:`~docker.api.image.ImageApiMixin.pull` method in the
low-... | docker/models/images.py | def pull(self, repository, tag=None, **kwargs):
"""
Pull an image of the given name and return it. Similar to the
``docker pull`` command.
If no tag is specified, all tags from that repository will be
pulled.
If you want to get the raw pull output, use the
:py:me... | def pull(self, repository, tag=None, **kwargs):
"""
Pull an image of the given name and return it. Similar to the
``docker pull`` command.
If no tag is specified, all tags from that repository will be
pulled.
If you want to get the raw pull output, use the
:py:me... | [
"Pull",
"an",
"image",
"of",
"the",
"given",
"name",
"and",
"return",
"it",
".",
"Similar",
"to",
"the",
"docker",
"pull",
"command",
".",
"If",
"no",
"tag",
"is",
"specified",
"all",
"tags",
"from",
"that",
"repository",
"will",
"be",
"pulled",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/images.py#L397-L455 | [
"def",
"pull",
"(",
"self",
",",
"repository",
",",
"tag",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"tag",
":",
"repository",
",",
"tag",
"=",
"parse_repository_tag",
"(",
"repository",
")",
"if",
"'stream'",
"in",
"kwargs",
":",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | _create_container_args | Convert arguments to create() to arguments to create_container(). | docker/models/containers.py | def _create_container_args(kwargs):
"""
Convert arguments to create() to arguments to create_container().
"""
# Copy over kwargs which can be copied directly
create_kwargs = {}
for key in copy.copy(kwargs):
if key in RUN_CREATE_KWARGS:
create_kwargs[key] = kwargs.pop(key)
... | def _create_container_args(kwargs):
"""
Convert arguments to create() to arguments to create_container().
"""
# Copy over kwargs which can be copied directly
create_kwargs = {}
for key in copy.copy(kwargs):
if key in RUN_CREATE_KWARGS:
create_kwargs[key] = kwargs.pop(key)
... | [
"Convert",
"arguments",
"to",
"create",
"()",
"to",
"arguments",
"to",
"create_container",
"()",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L1043-L1093 | [
"def",
"_create_container_args",
"(",
"kwargs",
")",
":",
"# Copy over kwargs which can be copied directly",
"create_kwargs",
"=",
"{",
"}",
"for",
"key",
"in",
"copy",
".",
"copy",
"(",
"kwargs",
")",
":",
"if",
"key",
"in",
"RUN_CREATE_KWARGS",
":",
"create_kwar... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.image | The image of the container. | docker/models/containers.py | def image(self):
"""
The image of the container.
"""
image_id = self.attrs.get('ImageID', self.attrs['Image'])
if image_id is None:
return None
return self.client.images.get(image_id.split(':')[1]) | def image(self):
"""
The image of the container.
"""
image_id = self.attrs.get('ImageID', self.attrs['Image'])
if image_id is None:
return None
return self.client.images.get(image_id.split(':')[1]) | [
"The",
"image",
"of",
"the",
"container",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L33-L40 | [
"def",
"image",
"(",
"self",
")",
":",
"image_id",
"=",
"self",
".",
"attrs",
".",
"get",
"(",
"'ImageID'",
",",
"self",
".",
"attrs",
"[",
"'Image'",
"]",
")",
"if",
"image_id",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"client",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.status | The status of the container. For example, ``running``, or ``exited``. | docker/models/containers.py | def status(self):
"""
The status of the container. For example, ``running``, or ``exited``.
"""
if isinstance(self.attrs['State'], dict):
return self.attrs['State']['Status']
return self.attrs['State'] | def status(self):
"""
The status of the container. For example, ``running``, or ``exited``.
"""
if isinstance(self.attrs['State'], dict):
return self.attrs['State']['Status']
return self.attrs['State'] | [
"The",
"status",
"of",
"the",
"container",
".",
"For",
"example",
"running",
"or",
"exited",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L57-L63 | [
"def",
"status",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"attrs",
"[",
"'State'",
"]",
",",
"dict",
")",
":",
"return",
"self",
".",
"attrs",
"[",
"'State'",
"]",
"[",
"'Status'",
"]",
"return",
"self",
".",
"attrs",
"[",
"'Sta... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.attach | Attach to this container.
:py:meth:`logs` 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:
stdout (bool): Include stdout.
stderr (bool): Include stderr.
... | docker/models/containers.py | def attach(self, **kwargs):
"""
Attach to this container.
:py:meth:`logs` 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:
stdout (bool): Include stdout... | def attach(self, **kwargs):
"""
Attach to this container.
:py:meth:`logs` 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:
stdout (bool): Include stdout... | [
"Attach",
"to",
"this",
"container",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L72-L96 | [
"def",
"attach",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"attach",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.attach_socket | Like :py:meth:`attach`, but returns the underlying socket-like object
for the HTTP request.
Args:
params (dict): Dictionary of request parameters (e.g. ``stdout``,
``stderr``, ``stream``).
ws (bool): Use websockets instead of raw HTTP.
Raises:
... | docker/models/containers.py | def attach_socket(self, **kwargs):
"""
Like :py:meth:`attach`, but returns the underlying socket-like object
for the HTTP request.
Args:
params (dict): Dictionary of request parameters (e.g. ``stdout``,
``stderr``, ``stream``).
ws (bool): Use webs... | def attach_socket(self, **kwargs):
"""
Like :py:meth:`attach`, but returns the underlying socket-like object
for the HTTP request.
Args:
params (dict): Dictionary of request parameters (e.g. ``stdout``,
``stderr``, ``stream``).
ws (bool): Use webs... | [
"Like",
":",
"py",
":",
"meth",
":",
"attach",
"but",
"returns",
"the",
"underlying",
"socket",
"-",
"like",
"object",
"for",
"the",
"HTTP",
"request",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L98-L112 | [
"def",
"attach_socket",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"attach_socket",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.commit | Commit a container to an image. Similar to the ``docker commit``
command.
Args:
repository (str): The repository to push the image to
tag (str): The tag to push
message (str): A commit message
author (str): The name of the author
changes (str)... | docker/models/containers.py | def commit(self, repository=None, tag=None, **kwargs):
"""
Commit a container to an image. Similar to the ``docker commit``
command.
Args:
repository (str): The repository to push the image to
tag (str): The tag to push
message (str): A commit message... | def commit(self, repository=None, tag=None, **kwargs):
"""
Commit a container to an image. Similar to the ``docker commit``
command.
Args:
repository (str): The repository to push the image to
tag (str): The tag to push
message (str): A commit message... | [
"Commit",
"a",
"container",
"to",
"an",
"image",
".",
"Similar",
"to",
"the",
"docker",
"commit",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L114-L137 | [
"def",
"commit",
"(",
"self",
",",
"repository",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"commit",
"(",
"self",
".",
"id",
",",
"repository",
"=",
"repository",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.exec_run | Run a command inside this container. Similar to
``docker exec``.
Args:
cmd (str or list): Command to be executed
stdout (bool): Attach to stdout. Default: ``True``
stderr (bool): Attach to stderr. Default: ``True``
stdin (bool): Attach to stdin. Default: ... | docker/models/containers.py | def exec_run(self, cmd, stdout=True, stderr=True, stdin=False, tty=False,
privileged=False, user='', detach=False, stream=False,
socket=False, environment=None, workdir=None, demux=False):
"""
Run a command inside this container. Similar to
``docker exec``.
... | def exec_run(self, cmd, stdout=True, stderr=True, stdin=False, tty=False,
privileged=False, user='', detach=False, stream=False,
socket=False, environment=None, workdir=None, demux=False):
"""
Run a command inside this container. Similar to
``docker exec``.
... | [
"Run",
"a",
"command",
"inside",
"this",
"container",
".",
"Similar",
"to",
"docker",
"exec",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L152-L208 | [
"def",
"exec_run",
"(",
"self",
",",
"cmd",
",",
"stdout",
"=",
"True",
",",
"stderr",
"=",
"True",
",",
"stdin",
"=",
"False",
",",
"tty",
"=",
"False",
",",
"privileged",
"=",
"False",
",",
"user",
"=",
"''",
",",
"detach",
"=",
"False",
",",
"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.export | Export the contents of the container's filesystem as a tar archive.
Args:
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: 2 MB
Returns:
(str): The f... | docker/models/containers.py | def export(self, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Export the contents of the container's filesystem as a tar archive.
Args:
chunk_size (int): The number of bytes returned by each iteration
of the generator. If ``None``, data will be streamed as it is
... | def export(self, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Export the contents of the container's filesystem as a tar archive.
Args:
chunk_size (int): The number of bytes returned by each iteration
of the generator. If ``None``, data will be streamed as it is
... | [
"Export",
"the",
"contents",
"of",
"the",
"container",
"s",
"filesystem",
"as",
"a",
"tar",
"archive",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L210-L226 | [
"def",
"export",
"(",
"self",
",",
"chunk_size",
"=",
"DEFAULT_DATA_CHUNK_SIZE",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"export",
"(",
"self",
".",
"id",
",",
"chunk_size",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.get_archive | Retrieve a file or folder from the container in the form of a tar
archive.
Args:
path (str): Path to the file or folder to retrieve
chunk_size (int): The number of bytes returned by each iteration
of the generator. If ``None``, data will be streamed as it is
... | docker/models/containers.py | def get_archive(self, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Retrieve a file or folder from the container in the form of a tar
archive.
Args:
path (str): Path to the file or folder to retrieve
chunk_size (int): The number of bytes returned by each iterati... | def get_archive(self, path, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Retrieve a file or folder from the container in the form of a tar
archive.
Args:
path (str): Path to the file or folder to retrieve
chunk_size (int): The number of bytes returned by each iterati... | [
"Retrieve",
"a",
"file",
"or",
"folder",
"from",
"the",
"container",
"in",
"the",
"form",
"of",
"a",
"tar",
"archive",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L228-L258 | [
"def",
"get_archive",
"(",
"self",
",",
"path",
",",
"chunk_size",
"=",
"DEFAULT_DATA_CHUNK_SIZE",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"get_archive",
"(",
"self",
".",
"id",
",",
"path",
",",
"chunk_size",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.kill | Kill or send a signal to the container.
Args:
signal (str or int): The signal to send. Defaults to ``SIGKILL``
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/models/containers.py | def kill(self, signal=None):
"""
Kill or send a signal to the container.
Args:
signal (str or int): The signal to send. Defaults to ``SIGKILL``
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return... | def kill(self, signal=None):
"""
Kill or send a signal to the container.
Args:
signal (str or int): The signal to send. Defaults to ``SIGKILL``
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return... | [
"Kill",
"or",
"send",
"a",
"signal",
"to",
"the",
"container",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L260-L272 | [
"def",
"kill",
"(",
"self",
",",
"signal",
"=",
"None",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"kill",
"(",
"self",
".",
"id",
",",
"signal",
"=",
"signal",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.logs | Get logs from this 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:
stdout (bool): Get ``STDOUT``. Default ``True``
stderr... | docker/models/containers.py | def logs(self, **kwargs):
"""
Get logs from this 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:
stdout (bool): Get `... | def logs(self, **kwargs):
"""
Get logs from this 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:
stdout (bool): Get `... | [
"Get",
"logs",
"from",
"this",
"container",
".",
"Similar",
"to",
"the",
"docker",
"logs",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L274-L302 | [
"def",
"logs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"logs",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.put_archive | Insert a file or folder in this container using a tar archive as
source.
Args:
path (str): Path inside the container where the file(s) will be
extracted. Must exist.
data (bytes): tar data to be extracted
Returns:
(bool): True if the call suc... | docker/models/containers.py | def put_archive(self, path, data):
"""
Insert a file or folder in this container using a tar archive as
source.
Args:
path (str): Path inside the container where the file(s) will be
extracted. Must exist.
data (bytes): tar data to be extracted
... | def put_archive(self, path, data):
"""
Insert a file or folder in this container using a tar archive as
source.
Args:
path (str): Path inside the container where the file(s) will be
extracted. Must exist.
data (bytes): tar data to be extracted
... | [
"Insert",
"a",
"file",
"or",
"folder",
"in",
"this",
"container",
"using",
"a",
"tar",
"archive",
"as",
"source",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L314-L330 | [
"def",
"put_archive",
"(",
"self",
",",
"path",
",",
"data",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"put_archive",
"(",
"self",
".",
"id",
",",
"path",
",",
"data",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.remove | Remove this container. Similar to the ``docker rm`` command.
Args:
v (bool): Remove the volumes associated with the container
link (bool): Remove the specified link and not the underlying
container
force (bool): Force the removal of a running container (uses
... | docker/models/containers.py | def remove(self, **kwargs):
"""
Remove this container. Similar to the ``docker rm`` command.
Args:
v (bool): Remove the volumes associated with the container
link (bool): Remove the specified link and not the underlying
container
force (bool):... | def remove(self, **kwargs):
"""
Remove this container. Similar to the ``docker rm`` command.
Args:
v (bool): Remove the volumes associated with the container
link (bool): Remove the specified link and not the underlying
container
force (bool):... | [
"Remove",
"this",
"container",
".",
"Similar",
"to",
"the",
"docker",
"rm",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L332-L347 | [
"def",
"remove",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"remove_container",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.rename | Rename this container. Similar to the ``docker rename`` command.
Args:
name (str): New name for the container
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/models/containers.py | def rename(self, name):
"""
Rename this container. Similar to the ``docker rename`` command.
Args:
name (str): New name for the container
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return self.c... | def rename(self, name):
"""
Rename this container. Similar to the ``docker rename`` command.
Args:
name (str): New name for the container
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return self.c... | [
"Rename",
"this",
"container",
".",
"Similar",
"to",
"the",
"docker",
"rename",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L349-L360 | [
"def",
"rename",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"rename",
"(",
"self",
".",
"id",
",",
"name",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.resize | Resize the tty session.
Args:
height (int): Height of tty session
width (int): Width of tty session
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/models/containers.py | def resize(self, height, width):
"""
Resize the tty session.
Args:
height (int): Height of tty session
width (int): Width of tty session
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
re... | def resize(self, height, width):
"""
Resize the tty session.
Args:
height (int): Height of tty session
width (int): Width of tty session
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
re... | [
"Resize",
"the",
"tty",
"session",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L362-L374 | [
"def",
"resize",
"(",
"self",
",",
"height",
",",
"width",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"resize",
"(",
"self",
".",
"id",
",",
"height",
",",
"width",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.restart | Restart this container. Similar to the ``docker restart`` command.
Args:
timeout (int): Number of seconds to try to stop for before killing
the container. Once killed it will then be restarted. Default
is 10 seconds.
Raises:
:py:class:`docker.err... | docker/models/containers.py | def restart(self, **kwargs):
"""
Restart this container. Similar to the ``docker restart`` command.
Args:
timeout (int): Number of seconds to try to stop for before killing
the container. Once killed it will then be restarted. Default
is 10 seconds.
... | def restart(self, **kwargs):
"""
Restart this container. Similar to the ``docker restart`` command.
Args:
timeout (int): Number of seconds to try to stop for before killing
the container. Once killed it will then be restarted. Default
is 10 seconds.
... | [
"Restart",
"this",
"container",
".",
"Similar",
"to",
"the",
"docker",
"restart",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L376-L389 | [
"def",
"restart",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"restart",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.start | Start this container. Similar to the ``docker start`` command, but
doesn't support attach options.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/models/containers.py | def start(self, **kwargs):
"""
Start this container. Similar to the ``docker start`` command, but
doesn't support attach options.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return self.client.api.start(self.... | def start(self, **kwargs):
"""
Start this container. Similar to the ``docker start`` command, but
doesn't support attach options.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return self.client.api.start(self.... | [
"Start",
"this",
"container",
".",
"Similar",
"to",
"the",
"docker",
"start",
"command",
"but",
"doesn",
"t",
"support",
"attach",
"options",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L391-L400 | [
"def",
"start",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"start",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.stats | Stream statistics for this container. Similar to the
``docker stats`` command.
Args:
decode (bool): If set to true, stream will be decoded into dicts
on the fly. Only applicable if ``stream`` is True.
False by default.
stream (bool): If set to fal... | docker/models/containers.py | def stats(self, **kwargs):
"""
Stream statistics for this container. Similar to the
``docker stats`` command.
Args:
decode (bool): If set to true, stream will be decoded into dicts
on the fly. Only applicable if ``stream`` is True.
False by de... | def stats(self, **kwargs):
"""
Stream statistics for this container. Similar to the
``docker stats`` command.
Args:
decode (bool): If set to true, stream will be decoded into dicts
on the fly. Only applicable if ``stream`` is True.
False by de... | [
"Stream",
"statistics",
"for",
"this",
"container",
".",
"Similar",
"to",
"the",
"docker",
"stats",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L402-L418 | [
"def",
"stats",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"stats",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.stop | Stops a container. Similar to the ``docker stop`` command.
Args:
timeout (int): Timeout in seconds to wait for the container to
stop before sending a ``SIGKILL``. Default: 10
Raises:
:py:class:`docker.errors.APIError`
If the server returns an err... | docker/models/containers.py | def stop(self, **kwargs):
"""
Stops a container. Similar to the ``docker stop`` command.
Args:
timeout (int): Timeout in seconds to wait for the container to
stop before sending a ``SIGKILL``. Default: 10
Raises:
:py:class:`docker.errors.APIError... | def stop(self, **kwargs):
"""
Stops a container. Similar to the ``docker stop`` command.
Args:
timeout (int): Timeout in seconds to wait for the container to
stop before sending a ``SIGKILL``. Default: 10
Raises:
:py:class:`docker.errors.APIError... | [
"Stops",
"a",
"container",
".",
"Similar",
"to",
"the",
"docker",
"stop",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L420-L432 | [
"def",
"stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"stop",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.top | Display the running processes of the container.
Args:
ps_args (str): An optional arguments passed to ps (e.g. ``aux``)
Returns:
(str): The output of the top
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/models/containers.py | def top(self, **kwargs):
"""
Display the running processes of the container.
Args:
ps_args (str): An optional arguments passed to ps (e.g. ``aux``)
Returns:
(str): The output of the top
Raises:
:py:class:`docker.errors.APIError`
... | def top(self, **kwargs):
"""
Display the running processes of the container.
Args:
ps_args (str): An optional arguments passed to ps (e.g. ``aux``)
Returns:
(str): The output of the top
Raises:
:py:class:`docker.errors.APIError`
... | [
"Display",
"the",
"running",
"processes",
"of",
"the",
"container",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L434-L448 | [
"def",
"top",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"top",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.update | Update resource configuration of the containers.
Args:
blkio_weight (int): Block IO (relative weight), between 10 and 1000
cpu_period (int): Limit CPU CFS (Completely Fair Scheduler) period
cpu_quota (int): Limit CPU CFS (Completely Fair Scheduler) quota
cpu_shar... | docker/models/containers.py | def update(self, **kwargs):
"""
Update resource configuration of the containers.
Args:
blkio_weight (int): Block IO (relative weight), between 10 and 1000
cpu_period (int): Limit CPU CFS (Completely Fair Scheduler) period
cpu_quota (int): Limit CPU CFS (Compl... | def update(self, **kwargs):
"""
Update resource configuration of the containers.
Args:
blkio_weight (int): Block IO (relative weight), between 10 and 1000
cpu_period (int): Limit CPU CFS (Completely Fair Scheduler) period
cpu_quota (int): Limit CPU CFS (Compl... | [
"Update",
"resource",
"configuration",
"of",
"the",
"containers",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L460-L485 | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"update_container",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Container.wait | Block until the container stops, then return its exit code. Similar to
the ``docker wait`` command.
Args:
timeout (int): Request timeout
condition (str): Wait until a container state reaches the given
condition, either ``not-running`` (default), ``next-exit``,
... | docker/models/containers.py | def wait(self, **kwargs):
"""
Block until the container stops, then return its exit code. Similar to
the ``docker wait`` command.
Args:
timeout (int): Request timeout
condition (str): Wait until a container state reaches the given
condition, eithe... | def wait(self, **kwargs):
"""
Block until the container stops, then return its exit code. Similar to
the ``docker wait`` command.
Args:
timeout (int): Request timeout
condition (str): Wait until a container state reaches the given
condition, eithe... | [
"Block",
"until",
"the",
"container",
"stops",
"then",
"return",
"its",
"exit",
"code",
".",
"Similar",
"to",
"the",
"docker",
"wait",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L487-L508 | [
"def",
"wait",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"api",
".",
"wait",
"(",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerCollection.run | Run a container. By default, it will wait for the container to finish
and return its logs, similar to ``docker run``.
If the ``detach`` argument is ``True``, it will start the container
and immediately return a :py:class:`Container` object, similar to
``docker run -d``.
Example... | docker/models/containers.py | def run(self, image, command=None, stdout=True, stderr=False,
remove=False, **kwargs):
"""
Run a container. By default, it will wait for the container to finish
and return its logs, similar to ``docker run``.
If the ``detach`` argument is ``True``, it will start the containe... | def run(self, image, command=None, stdout=True, stderr=False,
remove=False, **kwargs):
"""
Run a container. By default, it will wait for the container to finish
and return its logs, similar to ``docker run``.
If the ``detach`` argument is ``True``, it will start the containe... | [
"Run",
"a",
"container",
".",
"By",
"default",
"it",
"will",
"wait",
"for",
"the",
"container",
"to",
"finish",
"and",
"return",
"its",
"logs",
"similar",
"to",
"docker",
"run",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L514-L837 | [
"def",
"run",
"(",
"self",
",",
"image",
",",
"command",
"=",
"None",
",",
"stdout",
"=",
"True",
",",
"stderr",
"=",
"False",
",",
"remove",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"image",
",",
"Image",
")",
":... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerCollection.create | Create a container without starting it. Similar to ``docker create``.
Takes the same arguments as :py:meth:`run`, except for ``stdout``,
``stderr``, and ``remove``.
Returns:
A :py:class:`Container` object.
Raises:
:py:class:`docker.errors.ImageNotFound`
... | docker/models/containers.py | def create(self, image, command=None, **kwargs):
"""
Create a container without starting it. Similar to ``docker create``.
Takes the same arguments as :py:meth:`run`, except for ``stdout``,
``stderr``, and ``remove``.
Returns:
A :py:class:`Container` object.
... | def create(self, image, command=None, **kwargs):
"""
Create a container without starting it. Similar to ``docker create``.
Takes the same arguments as :py:meth:`run`, except for ``stdout``,
``stderr``, and ``remove``.
Returns:
A :py:class:`Container` object.
... | [
"Create",
"a",
"container",
"without",
"starting",
"it",
".",
"Similar",
"to",
"docker",
"create",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L839-L862 | [
"def",
"create",
"(",
"self",
",",
"image",
",",
"command",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"image",
",",
"Image",
")",
":",
"image",
"=",
"image",
".",
"id",
"kwargs",
"[",
"'image'",
"]",
"=",
"image",
"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerCollection.get | Get a container by name or ID.
Args:
container_id (str): Container name or ID.
Returns:
A :py:class:`Container` object.
Raises:
:py:class:`docker.errors.NotFound`
If the container does not exist.
:py:class:`docker.errors.APIError... | docker/models/containers.py | def get(self, container_id):
"""
Get a container by name or ID.
Args:
container_id (str): Container name or ID.
Returns:
A :py:class:`Container` object.
Raises:
:py:class:`docker.errors.NotFound`
If the container does not exi... | def get(self, container_id):
"""
Get a container by name or ID.
Args:
container_id (str): Container name or ID.
Returns:
A :py:class:`Container` object.
Raises:
:py:class:`docker.errors.NotFound`
If the container does not exi... | [
"Get",
"a",
"container",
"by",
"name",
"or",
"ID",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L864-L881 | [
"def",
"get",
"(",
"self",
",",
"container_id",
")",
":",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"inspect_container",
"(",
"container_id",
")",
"return",
"self",
".",
"prepare_model",
"(",
"resp",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ContainerCollection.list | List containers. Similar to the ``docker ps`` command.
Args:
all (bool): Show all containers. Only running containers are shown
by default
since (str): Show only containers created since Id or Name, include
non-running ones
before (str): Show ... | docker/models/containers.py | def list(self, all=False, before=None, filters=None, limit=-1, since=None,
sparse=False, ignore_removed=False):
"""
List containers. Similar to the ``docker ps`` command.
Args:
all (bool): Show all containers. Only running containers are shown
by default... | def list(self, all=False, before=None, filters=None, limit=-1, since=None,
sparse=False, ignore_removed=False):
"""
List containers. Similar to the ``docker ps`` command.
Args:
all (bool): Show all containers. Only running containers are shown
by default... | [
"List",
"containers",
".",
"Similar",
"to",
"the",
"docker",
"ps",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/containers.py#L883-L948 | [
"def",
"list",
"(",
"self",
",",
"all",
"=",
"False",
",",
"before",
"=",
"None",
",",
"filters",
"=",
"None",
",",
"limit",
"=",
"-",
"1",
",",
"since",
"=",
"None",
",",
"sparse",
"=",
"False",
",",
"ignore_removed",
"=",
"False",
")",
":",
"re... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Service.tasks | List the tasks in this service.
Args:
filters (dict): A map of filters to process on the tasks list.
Valid filters: ``id``, ``name``, ``node``,
``label``, and ``desired-state``.
Returns:
:py:class:`list`: List of task dictionaries.
Raise... | docker/models/services.py | def tasks(self, filters=None):
"""
List the tasks in this service.
Args:
filters (dict): A map of filters to process on the tasks list.
Valid filters: ``id``, ``name``, ``node``,
``label``, and ``desired-state``.
Returns:
:py:clas... | def tasks(self, filters=None):
"""
List the tasks in this service.
Args:
filters (dict): A map of filters to process on the tasks list.
Valid filters: ``id``, ``name``, ``node``,
``label``, and ``desired-state``.
Returns:
:py:clas... | [
"List",
"the",
"tasks",
"in",
"this",
"service",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L35-L54 | [
"def",
"tasks",
"(",
"self",
",",
"filters",
"=",
"None",
")",
":",
"if",
"filters",
"is",
"None",
":",
"filters",
"=",
"{",
"}",
"filters",
"[",
"'service'",
"]",
"=",
"self",
".",
"id",
"return",
"self",
".",
"client",
".",
"api",
".",
"tasks",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Service.update | Update a service's configuration. Similar to the ``docker service
update`` command.
Takes the same parameters as :py:meth:`~ServiceCollection.create`.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error. | docker/models/services.py | def update(self, **kwargs):
"""
Update a service's configuration. Similar to the ``docker service
update`` command.
Takes the same parameters as :py:meth:`~ServiceCollection.create`.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an... | def update(self, **kwargs):
"""
Update a service's configuration. Similar to the ``docker service
update`` command.
Takes the same parameters as :py:meth:`~ServiceCollection.create`.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an... | [
"Update",
"a",
"service",
"s",
"configuration",
".",
"Similar",
"to",
"the",
"docker",
"service",
"update",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L56-L83 | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Image is required, so if it hasn't been set, use current image",
"if",
"'image'",
"not",
"in",
"kwargs",
":",
"spec",
"=",
"self",
".",
"attrs",
"[",
"'Spec'",
"]",
"[",
"'TaskTemplate'",
"]",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Service.logs | Get log stream for the service.
Note: This method works only for services with the ``json-file``
or ``journald`` logging drivers.
Args:
details (bool): Show extra details provided to logs.
Default: ``False``
follow (bool): Keep connection open to read log... | docker/models/services.py | def logs(self, **kwargs):
"""
Get log stream for the service.
Note: This method works only for services with the ``json-file``
or ``journald`` logging drivers.
Args:
details (bool): Show extra details provided to logs.
Default: ``False``
f... | def logs(self, **kwargs):
"""
Get log stream for the service.
Note: This method works only for services with the ``json-file``
or ``journald`` logging drivers.
Args:
details (bool): Show extra details provided to logs.
Default: ``False``
f... | [
"Get",
"log",
"stream",
"for",
"the",
"service",
".",
"Note",
":",
"This",
"method",
"works",
"only",
"for",
"services",
"with",
"the",
"json",
"-",
"file",
"or",
"journald",
"logging",
"drivers",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L85-L112 | [
"def",
"logs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"is_tty",
"=",
"self",
".",
"attrs",
"[",
"'Spec'",
"]",
"[",
"'TaskTemplate'",
"]",
"[",
"'ContainerSpec'",
"]",
".",
"get",
"(",
"'TTY'",
",",
"False",
")",
"return",
"self",
".",
"cl... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Service.scale | Scale service container.
Args:
replicas (int): The number of containers that should be running.
Returns:
bool: ``True`` if successful. | docker/models/services.py | def scale(self, replicas):
"""
Scale service container.
Args:
replicas (int): The number of containers that should be running.
Returns:
bool: ``True`` if successful.
"""
if 'Global' in self.attrs['Spec']['Mode'].keys():
raise Invalid... | def scale(self, replicas):
"""
Scale service container.
Args:
replicas (int): The number of containers that should be running.
Returns:
bool: ``True`` if successful.
"""
if 'Global' in self.attrs['Spec']['Mode'].keys():
raise Invalid... | [
"Scale",
"service",
"container",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L114-L131 | [
"def",
"scale",
"(",
"self",
",",
"replicas",
")",
":",
"if",
"'Global'",
"in",
"self",
".",
"attrs",
"[",
"'Spec'",
"]",
"[",
"'Mode'",
"]",
".",
"keys",
"(",
")",
":",
"raise",
"InvalidArgument",
"(",
"'Cannot scale a global container'",
")",
"service_mo... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ServiceCollection.create | Create a service. Similar to the ``docker service create`` command.
Args:
image (str): The image name to use for the containers.
command (list of str or str): Command to run.
args (list of str): Arguments to the command.
constraints (list of str): :py:class:`~doc... | docker/models/services.py | def create(self, image, command=None, **kwargs):
"""
Create a service. Similar to the ``docker service create`` command.
Args:
image (str): The image name to use for the containers.
command (list of str or str): Command to run.
args (list of str): Arguments t... | def create(self, image, command=None, **kwargs):
"""
Create a service. Similar to the ``docker service create`` command.
Args:
image (str): The image name to use for the containers.
command (list of str or str): Command to run.
args (list of str): Arguments t... | [
"Create",
"a",
"service",
".",
"Similar",
"to",
"the",
"docker",
"service",
"create",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L148-L224 | [
"def",
"create",
"(",
"self",
",",
"image",
",",
"command",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'image'",
"]",
"=",
"image",
"kwargs",
"[",
"'command'",
"]",
"=",
"command",
"create_kwargs",
"=",
"_get_create_service_kwargs",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ServiceCollection.get | Get a service.
Args:
service_id (str): The ID of the service.
insert_defaults (boolean): If true, default values will be merged
into the output.
Returns:
:py:class:`Service`: The service.
Raises:
:py:class:`docker.errors.NotFound... | docker/models/services.py | def get(self, service_id, insert_defaults=None):
"""
Get a service.
Args:
service_id (str): The ID of the service.
insert_defaults (boolean): If true, default values will be merged
into the output.
Returns:
:py:class:`Service`: The se... | def get(self, service_id, insert_defaults=None):
"""
Get a service.
Args:
service_id (str): The ID of the service.
insert_defaults (boolean): If true, default values will be merged
into the output.
Returns:
:py:class:`Service`: The se... | [
"Get",
"a",
"service",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L226-L249 | [
"def",
"get",
"(",
"self",
",",
"service_id",
",",
"insert_defaults",
"=",
"None",
")",
":",
"return",
"self",
".",
"prepare_model",
"(",
"self",
".",
"client",
".",
"api",
".",
"inspect_service",
"(",
"service_id",
",",
"insert_defaults",
")",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ServiceCollection.list | List services.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name`` , ``label`` and ``mode``.
Default: ``None``.
Returns:
list of :py:class:`Service`: The services.
Raises:
:py:class:`do... | docker/models/services.py | def list(self, **kwargs):
"""
List services.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name`` , ``label`` and ``mode``.
Default: ``None``.
Returns:
list of :py:class:`Service`: The servic... | def list(self, **kwargs):
"""
List services.
Args:
filters (dict): Filters to process on the nodes list. Valid
filters: ``id``, ``name`` , ``label`` and ``mode``.
Default: ``None``.
Returns:
list of :py:class:`Service`: The servic... | [
"List",
"services",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/services.py#L251-L270 | [
"def",
"list",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"self",
".",
"prepare_model",
"(",
"s",
")",
"for",
"s",
"in",
"self",
".",
"client",
".",
"api",
".",
"services",
"(",
"*",
"*",
"kwargs",
")",
"]"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Model.reload | Load this object from the server again and update ``attrs`` with the
new data. | docker/models/resource.py | def reload(self):
"""
Load this object from the server again and update ``attrs`` with the
new data.
"""
new_model = self.collection.get(self.id)
self.attrs = new_model.attrs | def reload(self):
"""
Load this object from the server again and update ``attrs`` with the
new data.
"""
new_model = self.collection.get(self.id)
self.attrs = new_model.attrs | [
"Load",
"this",
"object",
"from",
"the",
"server",
"again",
"and",
"update",
"attrs",
"with",
"the",
"new",
"data",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/resource.py#L43-L49 | [
"def",
"reload",
"(",
"self",
")",
":",
"new_model",
"=",
"self",
".",
"collection",
".",
"get",
"(",
"self",
".",
"id",
")",
"self",
".",
"attrs",
"=",
"new_model",
".",
"attrs"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Collection.prepare_model | Create a model from a set of attributes. | docker/models/resource.py | def prepare_model(self, attrs):
"""
Create a model from a set of attributes.
"""
if isinstance(attrs, Model):
attrs.client = self.client
attrs.collection = self
return attrs
elif isinstance(attrs, dict):
return self.model(attrs=attr... | def prepare_model(self, attrs):
"""
Create a model from a set of attributes.
"""
if isinstance(attrs, Model):
attrs.client = self.client
attrs.collection = self
return attrs
elif isinstance(attrs, dict):
return self.model(attrs=attr... | [
"Create",
"a",
"model",
"from",
"a",
"set",
"of",
"attributes",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/resource.py#L81-L93 | [
"def",
"prepare_model",
"(",
"self",
",",
"attrs",
")",
":",
"if",
"isinstance",
"(",
"attrs",
",",
"Model",
")",
":",
"attrs",
".",
"client",
"=",
"self",
".",
"client",
"attrs",
".",
"collection",
"=",
"self",
"return",
"attrs",
"elif",
"isinstance",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Network.containers | The containers that are connected to the network, as a list of
:py:class:`~docker.models.containers.Container` objects. | docker/models/networks.py | def containers(self):
"""
The containers that are connected to the network, as a list of
:py:class:`~docker.models.containers.Container` objects.
"""
return [
self.client.containers.get(cid) for cid in
(self.attrs.get('Containers') or {}).keys()
] | def containers(self):
"""
The containers that are connected to the network, as a list of
:py:class:`~docker.models.containers.Container` objects.
"""
return [
self.client.containers.get(cid) for cid in
(self.attrs.get('Containers') or {}).keys()
] | [
"The",
"containers",
"that",
"are",
"connected",
"to",
"the",
"network",
"as",
"a",
"list",
"of",
":",
"py",
":",
"class",
":",
"~docker",
".",
"models",
".",
"containers",
".",
"Container",
"objects",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/networks.py#L19-L27 | [
"def",
"containers",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"client",
".",
"containers",
".",
"get",
"(",
"cid",
")",
"for",
"cid",
"in",
"(",
"self",
".",
"attrs",
".",
"get",
"(",
"'Containers'",
")",
"or",
"{",
"}",
")",
".",
"keys... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Network.connect | Connect a container to this network.
Args:
container (str): Container to connect to this network, as either
an ID, name, or :py:class:`~docker.models.containers.Container`
object.
aliases (:py:class:`list`): A list of aliases for this endpoint.
... | docker/models/networks.py | def connect(self, container, *args, **kwargs):
"""
Connect a container to this network.
Args:
container (str): Container to connect to this network, as either
an ID, name, or :py:class:`~docker.models.containers.Container`
object.
aliases ... | def connect(self, container, *args, **kwargs):
"""
Connect a container to this network.
Args:
container (str): Container to connect to this network, as either
an ID, name, or :py:class:`~docker.models.containers.Container`
object.
aliases ... | [
"Connect",
"a",
"container",
"to",
"this",
"network",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/networks.py#L29-L58 | [
"def",
"connect",
"(",
"self",
",",
"container",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"container",
",",
"Container",
")",
":",
"container",
"=",
"container",
".",
"id",
"return",
"self",
".",
"client",
".",
"a... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Network.disconnect | Disconnect a container from this network.
Args:
container (str): Container to disconnect from this network, as
either an ID, name, or
:py:class:`~docker.models.containers.Container` object.
force (bool): Force the container to disconnect from a network.
... | docker/models/networks.py | def disconnect(self, container, *args, **kwargs):
"""
Disconnect a container from this network.
Args:
container (str): Container to disconnect from this network, as
either an ID, name, or
:py:class:`~docker.models.containers.Container` object.
... | def disconnect(self, container, *args, **kwargs):
"""
Disconnect a container from this network.
Args:
container (str): Container to disconnect from this network, as
either an ID, name, or
:py:class:`~docker.models.containers.Container` object.
... | [
"Disconnect",
"a",
"container",
"from",
"this",
"network",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/networks.py#L60-L79 | [
"def",
"disconnect",
"(",
"self",
",",
"container",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"container",
",",
"Container",
")",
":",
"container",
"=",
"container",
".",
"id",
"return",
"self",
".",
"client",
".",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | NetworkCollection.create | 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 scheme for... | docker/models/networks.py | def create(self, name, *args, **kwargs):
"""
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... | def create(self, name, *args, **kwargs):
"""
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... | [
"Create",
"a",
"network",
".",
"Similar",
"to",
"the",
"docker",
"network",
"create",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/networks.py#L98-L155 | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"create_network",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | NetworkCollection.get | Get a network by its ID.
Args:
network_id (str): The ID of the network.
verbose (bool): Retrieve the service details across the cluster in
swarm mode.
scope (str): Filter the network by scope (``swarm``, ``global``
or ``local``).
Retu... | docker/models/networks.py | def get(self, network_id, *args, **kwargs):
"""
Get a network by its ID.
Args:
network_id (str): The ID of the network.
verbose (bool): Retrieve the service details across the cluster in
swarm mode.
scope (str): Filter the network by scope (``... | def get(self, network_id, *args, **kwargs):
"""
Get a network by its ID.
Args:
network_id (str): The ID of the network.
verbose (bool): Retrieve the service details across the cluster in
swarm mode.
scope (str): Filter the network by scope (``... | [
"Get",
"a",
"network",
"by",
"its",
"ID",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/networks.py#L157-L181 | [
"def",
"get",
"(",
"self",
",",
"network_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"prepare_model",
"(",
"self",
".",
"client",
".",
"api",
".",
"inspect_network",
"(",
"network_id",
",",
"*",
"args",
",",
"*",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | NetworkCollection.list | List networks. Similar to the ``docker networks 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:
... | docker/models/networks.py | def list(self, *args, **kwargs):
"""
List networks. Similar to the ``docker networks 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 net... | def list(self, *args, **kwargs):
"""
List networks. Similar to the ``docker networks 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 net... | [
"List",
"networks",
".",
"Similar",
"to",
"the",
"docker",
"networks",
"ls",
"command",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/networks.py#L183-L211 | [
"def",
"list",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"greedy",
"=",
"kwargs",
".",
"pop",
"(",
"'greedy'",
",",
"False",
")",
"resp",
"=",
"self",
".",
"client",
".",
"api",
".",
"networks",
"(",
"*",
"args",
",",
"*... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | AuthConfig.parse_auth | 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. | docker/auth.py | 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... | 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"
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/auth.py#L87-L153 | [
"def",
"parse_auth",
"(",
"cls",
",",
"entries",
",",
"raise_on_error",
"=",
"False",
")",
":",
"conf",
"=",
"{",
"}",
"for",
"registry",
",",
"entry",
"in",
"six",
".",
"iteritems",
"(",
"entries",
")",
":",
"if",
"not",
"isinstance",
"(",
"entry",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | AuthConfig.resolve_authconfig | 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. | docker/auth.py | 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... | 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"... | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/auth.py#L221-L254 | [
"def",
"resolve_authconfig",
"(",
"self",
",",
"registry",
"=",
"None",
")",
":",
"if",
"self",
".",
"creds_store",
"or",
"self",
".",
"cred_helpers",
":",
"store_name",
"=",
"self",
".",
"get_credential_store",
"(",
"registry",
")",
"if",
"store_name",
"is"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ExecApiMixin.exec_create | 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): Attach to stde... | docker/api/exec_api.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/exec_api.py#L9-L80 | [
"def",
"exec_create",
"(",
"self",
",",
"container",
",",
"cmd",
",",
"stdout",
"=",
"True",
",",
"stderr",
"=",
"True",
",",
"stdin",
"=",
"False",
",",
"tty",
"=",
"False",
",",
"privileged",
"=",
"False",
",",
"user",
"=",
"''",
",",
"environment"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ExecApiMixin.exec_inspect | 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 error. | docker/api/exec_api.py | 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`
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/exec_api.py#L82-L99 | [
"def",
"exec_inspect",
"(",
"self",
",",
"exec_id",
")",
":",
"if",
"isinstance",
"(",
"exec_id",
",",
"dict",
")",
":",
"exec_id",
"=",
"exec_id",
".",
"get",
"(",
"'Id'",
")",
"res",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
"\"/ex... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ExecApiMixin.exec_resize | 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 | docker/api/exec_api.py | 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 ... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/exec_api.py#L101-L117 | [
"def",
"exec_resize",
"(",
"self",
",",
"exec_id",
",",
"height",
"=",
"None",
",",
"width",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"exec_id",
",",
"dict",
")",
":",
"exec_id",
"=",
"exec_id",
".",
"get",
"(",
"'Id'",
")",
"params",
"=",
"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | ExecApiMixin.exec_start | 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): Stream response data. Defau... | docker/api/exec_api.py | 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.
... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/exec_api.py#L120-L169 | [
"def",
"exec_start",
"(",
"self",
",",
"exec_id",
",",
"detach",
"=",
"False",
",",
"tty",
"=",
"False",
",",
"stream",
"=",
"False",
",",
"socket",
"=",
"False",
",",
"demux",
"=",
"False",
")",
":",
"# we want opened socket if socket == True",
"data",
"=... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient._raise_for_status | Raises stored :class:`APIError`, if one occurred. | docker/api/client.py | 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) | 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) | [
"Raises",
"stored",
":",
"class",
":",
"APIError",
"if",
"one",
"occurred",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L258-L263 | [
"def",
"_raise_for_status",
"(",
"self",
",",
"response",
")",
":",
"try",
":",
"response",
".",
"raise_for_status",
"(",
")",
"except",
"requests",
".",
"exceptions",
".",
"HTTPError",
"as",
"e",
":",
"raise",
"create_api_error_from_http_exception",
"(",
"e",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient._stream_helper | Generator for data coming from a chunked-encoded HTTP response. | docker/api/client.py | def _stream_helper(self, response, decode=False):
"""Generator for data coming from a chunked-encoded HTTP response."""
if response.raw._fp.chunked:
if decode:
for chunk in json_stream(self._stream_helper(response, False)):
yield chunk
else:
... | def _stream_helper(self, response, decode=False):
"""Generator for data coming from a chunked-encoded HTTP response."""
if response.raw._fp.chunked:
if decode:
for chunk in json_stream(self._stream_helper(response, False)):
yield chunk
else:
... | [
"Generator",
"for",
"data",
"coming",
"from",
"a",
"chunked",
"-",
"encoded",
"HTTP",
"response",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L334-L354 | [
"def",
"_stream_helper",
"(",
"self",
",",
"response",
",",
"decode",
"=",
"False",
")",
":",
"if",
"response",
".",
"raw",
".",
"_fp",
".",
"chunked",
":",
"if",
"decode",
":",
"for",
"chunk",
"in",
"json_stream",
"(",
"self",
".",
"_stream_helper",
"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient._multiplexed_buffer_helper | A generator of multiplexed data blocks read from a buffered
response. | docker/api/client.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L356-L370 | [
"def",
"_multiplexed_buffer_helper",
"(",
"self",
",",
"response",
")",
":",
"buf",
"=",
"self",
".",
"_result",
"(",
"response",
",",
"binary",
"=",
"True",
")",
"buf_length",
"=",
"len",
"(",
"buf",
")",
"walker",
"=",
"0",
"while",
"True",
":",
"if"... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient._multiplexed_response_stream_helper | A generator of multiplexed data blocks coming from a response
stream. | docker/api/client.py | 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... | 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",
"."
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L372-L391 | [
"def",
"_multiplexed_response_stream_helper",
"(",
"self",
",",
"response",
")",
":",
"# Disable timeout on the underlying socket to prevent",
"# Read timed out(s) for long running processes",
"socket",
"=",
"self",
".",
"_get_raw_response_socket",
"(",
"response",
")",
"self",
... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient._stream_raw_result | Stream result for TTY-enabled container and raw binary data | docker/api/client.py | 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)
for out in response.iter_content(chunk_size, decode):
yield out | 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)
for out in response.iter_content(chunk_size, decode):
yield out | [
"Stream",
"result",
"for",
"TTY",
"-",
"enabled",
"container",
"and",
"raw",
"binary",
"data"
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L393-L397 | [
"def",
"_stream_raw_result",
"(",
"self",
",",
"response",
",",
"chunk_size",
"=",
"1",
",",
"decode",
"=",
"True",
")",
":",
"self",
".",
"_raise_for_status",
"(",
"response",
")",
"for",
"out",
"in",
"response",
".",
"iter_content",
"(",
"chunk_size",
",... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient._disable_socket_timeout | 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 one... | docker/api/client.py | 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... | 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",
"... | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L417-L443 | [
"def",
"_disable_socket_timeout",
"(",
"self",
",",
"socket",
")",
":",
"sockets",
"=",
"[",
"socket",
",",
"getattr",
"(",
"socket",
",",
"'_sock'",
",",
"None",
")",
"]",
"for",
"s",
"in",
"sockets",
":",
"if",
"not",
"hasattr",
"(",
"s",
",",
"'se... | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | APIClient.reload_config | 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 | docker/api/client.py | 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``)
... | 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"
] | docker/docker-py | python | https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/client.py#L486-L500 | [
"def",
"reload_config",
"(",
"self",
",",
"dockercfg_path",
"=",
"None",
")",
":",
"self",
".",
"_auth_configs",
"=",
"auth",
".",
"load_config",
"(",
"dockercfg_path",
",",
"credstore_env",
"=",
"self",
".",
"credstore_env",
")"
] | 613d6aad83acc9931ff2ecfd6a6c7bd8061dc125 |
train | Lock.acquire | Use Redis to hold a shared, distributed lock named ``name``.
Returns True once the lock is acquired.
If ``blocking`` is False, always return immediately. If the lock
was acquired, return True, otherwise return False.
``blocking_timeout`` specifies the maximum number of seconds to
... | redis/lock.py | def acquire(self, blocking=None, blocking_timeout=None, token=None):
"""
Use Redis to hold a shared, distributed lock named ``name``.
Returns True once the lock is acquired.
If ``blocking`` is False, always return immediately. If the lock
was acquired, return True, otherwise ret... | def acquire(self, blocking=None, blocking_timeout=None, token=None):
"""
Use Redis to hold a shared, distributed lock named ``name``.
Returns True once the lock is acquired.
If ``blocking`` is False, always return immediately. If the lock
was acquired, return True, otherwise ret... | [
"Use",
"Redis",
"to",
"hold",
"a",
"shared",
"distributed",
"lock",
"named",
"name",
".",
"Returns",
"True",
"once",
"the",
"lock",
"is",
"acquired",
"."
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/lock.py#L152-L189 | [
"def",
"acquire",
"(",
"self",
",",
"blocking",
"=",
"None",
",",
"blocking_timeout",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"sleep",
"=",
"self",
".",
"sleep",
"if",
"token",
"is",
"None",
":",
"token",
"=",
"uuid",
".",
"uuid1",
"(",
"... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Lock.owned | Returns True if this key is locked by this lock, otherwise False. | redis/lock.py | def owned(self):
"""
Returns True if this key is locked by this lock, otherwise False.
"""
stored_token = self.redis.get(self.name)
# need to always compare bytes to bytes
# TODO: this can be simplified when the context manager is finished
if stored_token and not ... | def owned(self):
"""
Returns True if this key is locked by this lock, otherwise False.
"""
stored_token = self.redis.get(self.name)
# need to always compare bytes to bytes
# TODO: this can be simplified when the context manager is finished
if stored_token and not ... | [
"Returns",
"True",
"if",
"this",
"key",
"is",
"locked",
"by",
"this",
"lock",
"otherwise",
"False",
"."
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/lock.py#L207-L218 | [
"def",
"owned",
"(",
"self",
")",
":",
"stored_token",
"=",
"self",
".",
"redis",
".",
"get",
"(",
"self",
".",
"name",
")",
"# need to always compare bytes to bytes",
"# TODO: this can be simplified when the context manager is finished",
"if",
"stored_token",
"and",
"n... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Lock.reacquire | Resets a TTL of an already acquired lock back to a timeout value. | redis/lock.py | def reacquire(self):
"""
Resets a TTL of an already acquired lock back to a timeout value.
"""
if self.local.token is None:
raise LockError("Cannot reacquire an unlocked lock")
if self.timeout is None:
raise LockError("Cannot reacquire a lock with no timeo... | def reacquire(self):
"""
Resets a TTL of an already acquired lock back to a timeout value.
"""
if self.local.token is None:
raise LockError("Cannot reacquire an unlocked lock")
if self.timeout is None:
raise LockError("Cannot reacquire a lock with no timeo... | [
"Resets",
"a",
"TTL",
"of",
"an",
"already",
"acquired",
"lock",
"back",
"to",
"a",
"timeout",
"value",
"."
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/lock.py#L257-L265 | [
"def",
"reacquire",
"(",
"self",
")",
":",
"if",
"self",
".",
"local",
".",
"token",
"is",
"None",
":",
"raise",
"LockError",
"(",
"\"Cannot reacquire an unlocked lock\"",
")",
"if",
"self",
".",
"timeout",
"is",
"None",
":",
"raise",
"LockError",
"(",
"\"... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | timestamp_to_datetime | Converts a unix timestamp to a Python datetime object | redis/client.py | def timestamp_to_datetime(response):
"Converts a unix timestamp to a Python datetime object"
if not response:
return None
try:
response = int(response)
except ValueError:
return None
return datetime.datetime.fromtimestamp(response) | def timestamp_to_datetime(response):
"Converts a unix timestamp to a Python datetime object"
if not response:
return None
try:
response = int(response)
except ValueError:
return None
return datetime.datetime.fromtimestamp(response) | [
"Converts",
"a",
"unix",
"timestamp",
"to",
"a",
"Python",
"datetime",
"object"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L48-L56 | [
"def",
"timestamp_to_datetime",
"(",
"response",
")",
":",
"if",
"not",
"response",
":",
"return",
"None",
"try",
":",
"response",
"=",
"int",
"(",
"response",
")",
"except",
"ValueError",
":",
"return",
"None",
"return",
"datetime",
".",
"datetime",
".",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | pairs_to_dict | Create a dict given a list of key/value pairs | redis/client.py | def pairs_to_dict(response, decode_keys=False):
"Create a dict given a list of key/value pairs"
if response is None:
return {}
if decode_keys:
# the iter form is faster, but I don't know how to make that work
# with a nativestr() map
return dict(izip(imap(nativestr, response[... | def pairs_to_dict(response, decode_keys=False):
"Create a dict given a list of key/value pairs"
if response is None:
return {}
if decode_keys:
# the iter form is faster, but I don't know how to make that work
# with a nativestr() map
return dict(izip(imap(nativestr, response[... | [
"Create",
"a",
"dict",
"given",
"a",
"list",
"of",
"key",
"/",
"value",
"pairs"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L192-L202 | [
"def",
"pairs_to_dict",
"(",
"response",
",",
"decode_keys",
"=",
"False",
")",
":",
"if",
"response",
"is",
"None",
":",
"return",
"{",
"}",
"if",
"decode_keys",
":",
"# the iter form is faster, but I don't know how to make that work",
"# with a nativestr() map",
"retu... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | zset_score_pairs | If ``withscores`` is specified in the options, return the response as
a list of (value, score) pairs | redis/client.py | def zset_score_pairs(response, **options):
"""
If ``withscores`` is specified in the options, return the response as
a list of (value, score) pairs
"""
if not response or not options.get('withscores'):
return response
score_cast_func = options.get('score_cast_func', float)
it = iter(... | def zset_score_pairs(response, **options):
"""
If ``withscores`` is specified in the options, return the response as
a list of (value, score) pairs
"""
if not response or not options.get('withscores'):
return response
score_cast_func = options.get('score_cast_func', float)
it = iter(... | [
"If",
"withscores",
"is",
"specified",
"in",
"the",
"options",
"return",
"the",
"response",
"as",
"a",
"list",
"of",
"(",
"value",
"score",
")",
"pairs"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L220-L229 | [
"def",
"zset_score_pairs",
"(",
"response",
",",
"*",
"*",
"options",
")",
":",
"if",
"not",
"response",
"or",
"not",
"options",
".",
"get",
"(",
"'withscores'",
")",
":",
"return",
"response",
"score_cast_func",
"=",
"options",
".",
"get",
"(",
"'score_ca... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | sort_return_tuples | If ``groups`` is specified, return the response as a list of
n-element tuples with n being the value found in options['groups'] | redis/client.py | def sort_return_tuples(response, **options):
"""
If ``groups`` is specified, return the response as a list of
n-element tuples with n being the value found in options['groups']
"""
if not response or not options.get('groups'):
return response
n = options['groups']
return list(izip(*[... | def sort_return_tuples(response, **options):
"""
If ``groups`` is specified, return the response as a list of
n-element tuples with n being the value found in options['groups']
"""
if not response or not options.get('groups'):
return response
n = options['groups']
return list(izip(*[... | [
"If",
"groups",
"is",
"specified",
"return",
"the",
"response",
"as",
"a",
"list",
"of",
"n",
"-",
"element",
"tuples",
"with",
"n",
"being",
"the",
"value",
"found",
"in",
"options",
"[",
"groups",
"]"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L232-L240 | [
"def",
"sort_return_tuples",
"(",
"response",
",",
"*",
"*",
"options",
")",
":",
"if",
"not",
"response",
"or",
"not",
"options",
".",
"get",
"(",
"'groups'",
")",
":",
"return",
"response",
"n",
"=",
"options",
"[",
"'groups'",
"]",
"return",
"list",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.from_url | Return a Redis client object configured from the given URL
For example::
redis://[:password]@localhost:6379/0
rediss://[:password]@localhost:6379/0
unix://[:password]@/path/to/socket.sock?db=0
Three URL schemes are supported:
- ```redis://``
<htt... | redis/client.py | def from_url(cls, url, db=None, **kwargs):
"""
Return a Redis client object configured from the given URL
For example::
redis://[:password]@localhost:6379/0
rediss://[:password]@localhost:6379/0
unix://[:password]@/path/to/socket.sock?db=0
Three URL... | def from_url(cls, url, db=None, **kwargs):
"""
Return a Redis client object configured from the given URL
For example::
redis://[:password]@localhost:6379/0
rediss://[:password]@localhost:6379/0
unix://[:password]@/path/to/socket.sock?db=0
Three URL... | [
"Return",
"a",
"Redis",
"client",
"object",
"configured",
"from",
"the",
"given",
"URL"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L571-L605 | [
"def",
"from_url",
"(",
"cls",
",",
"url",
",",
"db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"connection_pool",
"=",
"ConnectionPool",
".",
"from_url",
"(",
"url",
",",
"db",
"=",
"db",
",",
"*",
"*",
"kwargs",
")",
"return",
"cls",
"(",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.lock | Return a new Lock object using key ``name`` that mimics
the behavior of threading.Lock.
If specified, ``timeout`` indicates a maximum life for the lock.
By default, it will remain locked until release() is called.
``sleep`` indicates the amount of time to sleep per loop iteration
... | redis/client.py | def lock(self, name, timeout=None, sleep=0.1, blocking_timeout=None,
lock_class=None, thread_local=True):
"""
Return a new Lock object using key ``name`` that mimics
the behavior of threading.Lock.
If specified, ``timeout`` indicates a maximum life for the lock.
By ... | def lock(self, name, timeout=None, sleep=0.1, blocking_timeout=None,
lock_class=None, thread_local=True):
"""
Return a new Lock object using key ``name`` that mimics
the behavior of threading.Lock.
If specified, ``timeout`` indicates a maximum life for the lock.
By ... | [
"Return",
"a",
"new",
"Lock",
"object",
"using",
"key",
"name",
"that",
"mimics",
"the",
"behavior",
"of",
"threading",
".",
"Lock",
"."
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L710-L759 | [
"def",
"lock",
"(",
"self",
",",
"name",
",",
"timeout",
"=",
"None",
",",
"sleep",
"=",
"0.1",
",",
"blocking_timeout",
"=",
"None",
",",
"lock_class",
"=",
"None",
",",
"thread_local",
"=",
"True",
")",
":",
"if",
"lock_class",
"is",
"None",
":",
"... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.execute_command | Execute a command and return a parsed response | redis/client.py | def execute_command(self, *args, **options):
"Execute a command and return a parsed response"
pool = self.connection_pool
command_name = args[0]
connection = pool.get_connection(command_name, **options)
try:
connection.send_command(*args)
return self.parse... | def execute_command(self, *args, **options):
"Execute a command and return a parsed response"
pool = self.connection_pool
command_name = args[0]
connection = pool.get_connection(command_name, **options)
try:
connection.send_command(*args)
return self.parse... | [
"Execute",
"a",
"command",
"and",
"return",
"a",
"parsed",
"response"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L770-L786 | [
"def",
"execute_command",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"pool",
"=",
"self",
".",
"connection_pool",
"command_name",
"=",
"args",
"[",
"0",
"]",
"connection",
"=",
"pool",
".",
"get_connection",
"(",
"command_name",
"... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.parse_response | Parses a response from the Redis server | redis/client.py | def parse_response(self, connection, command_name, **options):
"Parses a response from the Redis server"
try:
response = connection.read_response()
except ResponseError:
if EMPTY_RESPONSE in options:
return options[EMPTY_RESPONSE]
raise
... | def parse_response(self, connection, command_name, **options):
"Parses a response from the Redis server"
try:
response = connection.read_response()
except ResponseError:
if EMPTY_RESPONSE in options:
return options[EMPTY_RESPONSE]
raise
... | [
"Parses",
"a",
"response",
"from",
"the",
"Redis",
"server"
] | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L788-L798 | [
"def",
"parse_response",
"(",
"self",
",",
"connection",
",",
"command_name",
",",
"*",
"*",
"options",
")",
":",
"try",
":",
"response",
"=",
"connection",
".",
"read_response",
"(",
")",
"except",
"ResponseError",
":",
"if",
"EMPTY_RESPONSE",
"in",
"option... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.client_kill_filter | Disconnects client(s) using a variety of filter options
:param id: Kills a client by its unique ID field
:param type: Kills a client by type where type is one of 'normal',
'master', 'slave' or 'pubsub'
:param addr: Kills a client by its 'address:port'
:param skipme: If True, then... | redis/client.py | def client_kill_filter(self, _id=None, _type=None, addr=None, skipme=None):
"""
Disconnects client(s) using a variety of filter options
:param id: Kills a client by its unique ID field
:param type: Kills a client by type where type is one of 'normal',
'master', 'slave' or 'pubsub... | def client_kill_filter(self, _id=None, _type=None, addr=None, skipme=None):
"""
Disconnects client(s) using a variety of filter options
:param id: Kills a client by its unique ID field
:param type: Kills a client by type where type is one of 'normal',
'master', 'slave' or 'pubsub... | [
"Disconnects",
"client",
"(",
"s",
")",
"using",
"a",
"variety",
"of",
"filter",
"options",
":",
"param",
"id",
":",
"Kills",
"a",
"client",
"by",
"its",
"unique",
"ID",
"field",
":",
"param",
"type",
":",
"Kills",
"a",
"client",
"by",
"type",
"where",... | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L816-L850 | [
"def",
"client_kill_filter",
"(",
"self",
",",
"_id",
"=",
"None",
",",
"_type",
"=",
"None",
",",
"addr",
"=",
"None",
",",
"skipme",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"if",
"_type",
"is",
"not",
"None",
":",
"client_types",
"=",
"(",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.client_list | Returns a list of currently connected clients.
If type of client specified, only that type will be returned.
:param _type: optional. one of the client types (normal, master,
replica, pubsub) | redis/client.py | def client_list(self, _type=None):
"""
Returns a list of currently connected clients.
If type of client specified, only that type will be returned.
:param _type: optional. one of the client types (normal, master,
replica, pubsub)
"""
"Returns a list of currently ... | def client_list(self, _type=None):
"""
Returns a list of currently connected clients.
If type of client specified, only that type will be returned.
:param _type: optional. one of the client types (normal, master,
replica, pubsub)
"""
"Returns a list of currently ... | [
"Returns",
"a",
"list",
"of",
"currently",
"connected",
"clients",
".",
"If",
"type",
"of",
"client",
"specified",
"only",
"that",
"type",
"will",
"be",
"returned",
".",
":",
"param",
"_type",
":",
"optional",
".",
"one",
"of",
"the",
"client",
"types",
... | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L852-L867 | [
"def",
"client_list",
"(",
"self",
",",
"_type",
"=",
"None",
")",
":",
"\"Returns a list of currently connected clients\"",
"if",
"_type",
"is",
"not",
"None",
":",
"client_types",
"=",
"(",
"'normal'",
",",
"'master'",
",",
"'replica'",
",",
"'pubsub'",
")",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
train | Redis.client_unblock | Unblocks a connection by its client id.
If ``error`` is True, unblocks the client with a special error message.
If ``error`` is False (default), the client is unblocked using the
regular timeout mechanism. | redis/client.py | def client_unblock(self, client_id, error=False):
"""
Unblocks a connection by its client id.
If ``error`` is True, unblocks the client with a special error message.
If ``error`` is False (default), the client is unblocked using the
regular timeout mechanism.
"""
... | def client_unblock(self, client_id, error=False):
"""
Unblocks a connection by its client id.
If ``error`` is True, unblocks the client with a special error message.
If ``error`` is False (default), the client is unblocked using the
regular timeout mechanism.
"""
... | [
"Unblocks",
"a",
"connection",
"by",
"its",
"client",
"id",
".",
"If",
"error",
"is",
"True",
"unblocks",
"the",
"client",
"with",
"a",
"special",
"error",
"message",
".",
"If",
"error",
"is",
"False",
"(",
"default",
")",
"the",
"client",
"is",
"unblock... | andymccurdy/redis-py | python | https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L881-L891 | [
"def",
"client_unblock",
"(",
"self",
",",
"client_id",
",",
"error",
"=",
"False",
")",
":",
"args",
"=",
"[",
"'CLIENT UNBLOCK'",
",",
"int",
"(",
"client_id",
")",
"]",
"if",
"error",
":",
"args",
".",
"append",
"(",
"Token",
".",
"get_token",
"(",
... | cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.