Ë
    9ài�¶  ã                   óæ   — d dl Z d dlZd dlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZmZ ddlmZmZ ddlmZ d	d
lmZ d	dlmZmZ  G d„ de«      Z G d„ de«      Zg d¢Zg d¢Zd„ Zd„ Z edd«      Zy)é    N)Ú
namedtupleé   )Ú	APIClient)ÚDEFAULT_DATA_CHUNK_SIZE)ÚContainerErrorÚDockerExceptionÚImageNotFoundÚNotFoundÚcreate_unexpected_kwargs_error)Ú
HostConfigÚNetworkingConfig)Úversion_gteé   )ÚImage)Ú
CollectionÚModelc                   ó
  — e Zd ZdZed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Z	ed„ «       Z
d„ Zd	„ Zd d„Zd„ Z	 	 	 d!d„Zefd„Zedfd„Zd"d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!y
)#Ú	ContaineraI   Local representation of a container object. Detailed configuration may
        be accessed through the :py:attr:`attrs` attribute. Note that local
        attributes are cached; users may call :py:meth:`reload` to
        query the Docker daemon for the current properties, causing
        :py:attr:`attrs` to be refreshed.
    c                 óv   — | j                   j                  d«      �| j                   d   j                  d«      S y)z,
        The name of the container.
        ÚNameNú/)ÚattrsÚgetÚlstrip©Úselfs    úY/home/factor_ks/STREAMA2026/venv/lib/python3.12/site-packages/docker/models/containers.pyÚnamezContainer.name   s6   € ð
 �:‰:�>‰>˜&Ó!Ð-Ø—:‘:˜fÑ%×,Ñ,¨SÓ1Ð1ð .ó    c                 óÈ   — | j                   j                  d| j                   d   «      }|€y| j                  j                  j                  |j	                  d«      d   «      S )z-
        The image of the container.
        ÚImageIDr   Nú:r   )r   r   ÚclientÚimagesÚsplit)r   Úimage_ids     r   ÚimagezContainer.image$   sS   € ð
 —:‘:—>‘> )¨T¯Z©Z¸Ñ-@ÓAˆØÐØØ�{‰{×!Ñ!×%Ñ% h§n¡n°SÓ&9¸!Ñ&<Ó=Ð=r   c                 ó†   — 	 | j                   d   j                  d«      }|xs i S # t        $ r}t        d«      |‚d}~ww xY w)z:
        The labels of a container as dictionary.
        ÚConfigÚLabelszYLabel data is not available for sparse objects. Call reload() to retrieve all informationN)r   r   ÚKeyErrorr   )r   ÚresultÚkes      r   ÚlabelszContainer.labels.   sQ   € ð
	Ø—Z‘Z Ñ)×-Ñ-¨hÓ7ˆFØ’<˜RÐøÜò 	Ü!ð/óð ðûð	ús   ‚#& ¦	A ¯;»A c                 ó~   — t        | j                  d   t        «      r| j                  d   d   S | j                  d   S )zW
        The status of the container. For example, ``running``, or ``exited``.
        ÚStateÚStatus)Ú
isinstancer   Údictr   s    r   ÚstatuszContainer.status<   s:   € ô
 �d—j‘j Ñ)¬4Ô0Ø—:‘:˜gÑ& xÑ0Ð0Ø�z‰z˜'Ñ"Ð"r   c                 óz   — | j                   j                  di «      j                  di «      j                  dd«      S )zm
        The healthcheck status of the container.

        For example, ``healthy`, or ``unhealthy`.
        r0   ÚHealthr1   Úunknown©r   r   r   s    r   ÚhealthzContainer.healthE   s3   € ð �z‰z�~‰~˜g rÓ*×.Ñ.¨x¸Ó<×@Ñ@ÀÈ9ÓUÐUr   c                 óZ   — | j                   j                  di «      j                  di «      S )zG
        The ports that the container exposes as a dictionary.
        ÚNetworkSettingsÚPortsr8   r   s    r   ÚportszContainer.portsN   s'   € ð
 �z‰z�~‰~Ð/°Ó4×8Ñ8¸À"ÓEÐEr   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )a  
        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.
            stream (bool): Return container output progressively as an iterator
                of strings, rather than a single string.
            logs (bool): Include the container's previous output.

        Returns:
            By default, the container's output as a single string.

            If ``stream=True``, an iterator of output strings.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   ÚapiÚattachÚid©r   Úkwargss     r   r@   zContainer.attachU   s(   € ð0 &ˆt�{‰{�‰×%Ñ% d§g¡gÑ8°Ñ8Ð8r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )a¦  
        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:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   Úattach_socketrA   rB   s     r   rE   zContainer.attach_socketo   s(   € ð -ˆt�{‰{�‰×,Ñ,¨T¯W©WÑ?¸Ñ?Ð?r   Nc                 óº   —  | j                   j                  j                  | j                  f||dœ|¤Ž}| j                   j                  j                  |d   «      S )a  
        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
            pause (bool): Whether to pause the container before committing
            changes (str): Dockerfile instructions to apply while committing
            conf (dict): The configuration for the container. See the
                `Engine API documentation
                <https://docs.docker.com/reference/api/docker_remote_api/>`_
                for full details.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )Ú
repositoryÚtagÚId)r#   r?   ÚcommitrA   r$   r   )r   rG   rH   rC   Úresps        r   rJ   zContainer.commit   sT   € ð, &ˆt�{‰{�‰×%Ñ% d§g¡gð 0¸*È#ñ 0Ø(.ñ0ˆà�{‰{×!Ñ!×%Ñ% d¨4¡jÓ1Ð1r   c                 ó`   — | j                   j                  j                  | j                  «      S )a'  
        Inspect changes on a container's filesystem.

        Returns:
            (list) A list of dictionaries containing the attributes `Path`
                and `Kind`.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚdiffrA   r   s    r   rM   zContainer.diff™   s!   € ð �{‰{�‰×#Ñ# D§G¡GÓ,Ð,r   Fc                 óZ  — | j                   j                  j                  | j                  |||||||||¬«
      }| j                   j                  j	                  |d   |||	|
|¬«      }|
s|	rt        d|«      S t        | j                   j                  j                  |d   «      d   |«      S )a1  
        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: ``False``
            tty (bool): Allocate a pseudo-TTY. Default: False
            privileged (bool): Run as privileged.
            user (str): User to execute command as. Default: root
            detach (bool): If true, detach from the exec command.
                Default: False
            stream (bool): Stream response data. Default: False
            socket (bool): Return the connection socket to allow custom
                read/write operations. Default: False
            environment (dict or list): A dictionary or a list of strings in
                the following format ``["PASSWORD=xxx"]`` or
                ``{"PASSWORD": "xxx"}``.
            workdir (str): Path to working directory for this exec session
            demux (bool): Return stdout and stderr separately

        Returns:
            (ExecResult): A tuple of (exit_code, output)
                exit_code: (int):
                    Exit code for the executed command or ``None`` if
                    either ``stream`` or ``socket`` is ``True``.
                output: (generator, bytes, or tuple):
                    If ``stream=True``, a generator yielding response chunks.
                    If ``socket=True``, a socket object for the connection.
                    If ``demux=True``, a tuple of two bytes: stdout and stderr.
                    A bytestring containing response data otherwise.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )ÚstdoutÚstderrÚstdinÚttyÚ
privilegedÚuserÚenvironmentÚworkdirrI   )ÚdetachrR   ÚstreamÚsocketÚdemuxNÚExitCode)r#   r?   Úexec_createrA   Ú
exec_startÚ
ExecResultÚexec_inspect)r   ÚcmdrO   rP   rQ   rR   rS   rT   rW   rX   rY   rU   rV   rZ   rK   Úexec_outputs                   r   Úexec_runzContainer.exec_run§   s±   € ðR �{‰{�‰×*Ñ*Ø�G‰G�S °¸eÈØ!¨¸+Øð +ó 
ˆð
 —k‘k—o‘o×0Ñ0Ø�‰J˜v¨3°vÀfØð 1ó 
ˆñ ‘VÜ˜d KÓ0Ð0äØ�K‰K�O‰O×(Ñ(¨¨d©Ó4°ZÑ@Øó
ð 	
r   c                 ób   — | j                   j                  j                  | j                  |«      S )a×  
        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 filesystem tar archive

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚexportrA   )r   Ú
chunk_sizes     r   rd   zContainer.exportá   s#   € ð  �{‰{�‰×%Ñ% d§g¡g¨zÓ:Ð:r   c                 óf   — | j                   j                  j                  | j                  |||«      S )aš  
        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
                received. Default: 2 MB
            encode_stream (bool): Determines if data should be encoded
                (gzip-compressed) during transmission. Default: False

        Returns:
            (tuple): First element is a raw tar data stream. Second element is
            a dict containing ``stat`` information on the specified ``path``.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.

        Example:

            >>> f = open('./sh_bin.tar', 'wb')
            >>> bits, stat = container.get_archive('/bin/sh')
            >>> print(stat)
            {'name': 'sh', 'size': 1075464, 'mode': 493,
             'mtime': '2018-10-01T15:37:48-07:00', 'linkTarget': ''}
            >>> for chunk in bits:
            ...    f.write(chunk)
            >>> f.close()
        )r#   r?   Úget_archiverA   )r   Úpathre   Úencode_streams       r   rg   zContainer.get_archiveó   s/   € ðB �{‰{�‰×*Ñ*¨4¯7©7°DØ+5°}óFð 	Fr   c                 ód   — | j                   j                  j                  | j                  |¬«      S )a  
        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.
        )Úsignal)r#   r?   ÚkillrA   )r   rk   s     r   rl   zContainer.kill  s&   € ð �{‰{�‰×#Ñ# D§G¡G°FÐ#Ó;Ð;r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )a  
        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 (bool): Get ``STDERR``. Default ``True``
            stream (bool): Stream the response. Default ``False``
            timestamps (bool): Show timestamps. Default ``False``
            tail (str or int): Output specified number of lines at the end of
                logs. Either an integer of number of lines or the string
                ``all``. Default ``all``
            since (datetime, int, or float): Show logs since a given datetime,
                integer epoch (in seconds) or float (in nanoseconds)
            follow (bool): Follow log output. Default ``False``
            until (datetime, int, or float): Show logs that occurred before
                the given datetime, integer epoch (in seconds), or
                float (in nanoseconds)

        Returns:
            (generator of bytes or bytes): Logs from the container.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚlogsrA   rB   s     r   rn   zContainer.logs%  s(   € ð: $ˆt�{‰{�‰×#Ñ# D§G¡GÑ6¨vÑ6Ð6r   c                 ó`   — | j                   j                  j                  | j                  «      S )z­
        Pauses all processes within this container.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚpauserA   r   s    r   rp   zContainer.pauseD  s!   € ð �{‰{�‰×$Ñ$ T§W¡WÓ-Ð-r   c                 ód   — | j                   j                  j                  | j                  ||«      S )a·  
        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 or stream): tar data to be extracted

        Returns:
            (bool): True if the call succeeds.

        Raises:
            :py:class:`~docker.errors.APIError` If an error occurs.
        )r#   r?   Úput_archiverA   )r   rh   Údatas      r   rr   zContainer.put_archiveN  s%   € ð  �{‰{�‰×*Ñ*¨4¯7©7°D¸$Ó?Ð?r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )aÞ  
        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
                ``SIGKILL``)

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   Úremove_containerrA   rB   s     r   ÚremovezContainer.remove`  s(   € ð 0ˆt�{‰{�‰×/Ñ/°·±ÑB¸6ÑBÐBr   c                 ób   — | j                   j                  j                  | j                  |«      S )a  
        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.
        )r#   r?   ÚrenamerA   )r   r   s     r   rx   zContainer.renameq  s#   € ð �{‰{�‰×%Ñ% d§g¡g¨tÓ4Ð4r   c                 ód   — | j                   j                  j                  | j                  ||«      S )a  
        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.
        )r#   r?   ÚresizerA   )r   ÚheightÚwidths      r   rz   zContainer.resize~  s%   € ð �{‰{�‰×%Ñ% d§g¡g¨v°uÓ=Ð=r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )a�  
        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.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚrestartrA   rB   s     r   r~   zContainer.restartŒ  s(   € ð 'ˆt�{‰{�‰×&Ñ& t§w¡wÑ9°&Ñ9Ð9r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )zì
        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.
        )r#   r?   ÚstartrA   rB   s     r   r€   zContainer.start›  s(   € ð %ˆt�{‰{�‰×$Ñ$ T§W¡WÑ7°Ñ7Ð7r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )a#  
        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 false, only the current stats will be
                returned instead of a stream. True by default.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚstatsrA   rB   s     r   r‚   zContainer.stats¦  s(   € ð  %ˆt�{‰{�‰×$Ñ$ T§W¡WÑ7°Ñ7Ð7r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )aU  
        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 error.
        )r#   r?   ÚstoprA   rB   s     r   r„   zContainer.stop¸  s(   € ð $ˆt�{‰{�‰×#Ñ# D§G¡GÑ6¨vÑ6Ð6r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )aH  
        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.
        )r#   r?   ÚtoprA   rB   s     r   r†   zContainer.topÆ  s(   € ð #ˆt�{‰{�‰×"Ñ" 4§7¡7Ñ5¨fÑ5Ð5r   c                 ó`   — | j                   j                  j                  | j                  «      S )z­
        Unpause all processes within the container.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚunpauserA   r   s    r   rˆ   zContainer.unpauseÖ  s!   € ð �{‰{�‰×&Ñ& t§w¡wÓ/Ð/r   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )a  
        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_shares (int): CPU shares (relative weight)
            cpuset_cpus (str): CPUs in which to allow execution
            cpuset_mems (str): MEMs in which to allow execution
            mem_limit (int or str): Memory limit
            mem_reservation (int or str): Memory soft limit
            memswap_limit (int or str): Total memory (memory + swap), -1 to
                disable swap
            kernel_memory (int or str): Kernel memory limit
            restart_policy (dict): Restart policy dictionary

        Returns:
            (dict): Dictionary containing a ``Warnings`` key.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   Úupdate_containerrA   rB   s     r   ÚupdatezContainer.updateà  s(   € ð2 0ˆt�{‰{�‰×/Ñ/°·±ÑB¸6ÑBÐBr   c                 ód   —  | j                   j                  j                  | j                  fi |¤ŽS )aë  
        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``,
                or ``removed``

        Returns:
            (dict): The API's response as a Python dictionary, including
                the container's exit code under the ``StatusCode`` attribute.

        Raises:
            :py:class:`requests.exceptions.ReadTimeout`
                If the timeout is exceeded.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )r#   r?   ÚwaitrA   rB   s     r   r�   zContainer.waitû  s(   € ð* $ˆt�{‰{�‰×#Ñ# D§G¡GÑ6¨vÑ6Ð6r   )NN)TTFFFÚ FFFNNF©N)"Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r'   r.   r4   r9   r=   r@   rE   rJ   rM   rb   r   rd   rg   rl   rn   rp   rr   rv   rx   rz   r~   r€   r‚   r„   r†   rˆ   r‹   r�   © r   r   r   r      s  „ ñð ñ2ó ð2ð ñ>ó ð>ð ñó ðð ñ#ó ð#ð ñVó ðVð ñFó ðFò9ò4@ó 2ò4-ð HMØAFØEJó8
ðt !8ó ;ð$ ,CØ"'ó"FóH<ò7ò>.ò@ò$Cò"5ò>ò:ò	8ò8ò$7ò6ò 0òCó67r   r   c                   ót   — e Zd ZeZ	 	 dd„Zdd„Zd„ Z	 	 d	d„Zdd„Z	e
j                  j                  e	_        y)
ÚContainerCollectionNc                 ó*  — t        |t        «      r|j                  }|j                  dd«      }|j                  dd«      }|j	                  dd«      }	|r=|r;t        | j                  j                  j                  d«      rd|d<   nt        d	«      ‚|j	                  d
«      r|j	                  d«      rt        d«      ‚|j	                  d«      r|j	                  d
«      st        d«      ‚	  | j                  d|||dœ|¤Ž}
|
j                  «        |r|
S |
j                  d   d   d   }d}|dk(  s|dk(  r|
j!                  ||dd¬«      }|
j#                  «       d   }|dk7  r&d}|j	                  d«      s|
j!                  dd¬«      }|r|
j%                  «        |dk7  rt'        |
||||«      ‚|s|€|S dj)                  |«      S # t        $ rA | j                  j                  j                  ||	¬«        | j                  d|||dœ|¤Ž}
Y �Œw xY w)aˆA  
        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:
            Run a container and get its output:

            >>> import docker
            >>> client = docker.from_env()
            >>> client.containers.run('alpine', 'echo hello world')
            b'hello world\n'

            Run a container and detach:

            >>> container = client.containers.run('bfirsh/reticulate-splines',
                                                  detach=True)
            >>> container.logs()
            'Reticulating spline 1...\nReticulating spline 2...\n'

        Args:
            image (str): The image to run.
            command (str or list): The command to run in the container.
            auto_remove (bool): enable auto-removal of the container on daemon
                side when the container's process exits.
            blkio_weight_device: Block IO weight (relative device weight) in
                the form of: ``[{"Path": "device_path", "Weight": weight}]``.
            blkio_weight: Block IO weight (relative weight), accepts a weight
                value between 10 and 1000.
            cap_add (list of str): Add kernel capabilities. For example,
                ``["SYS_ADMIN", "MKNOD"]``.
            cap_drop (list of str): Drop kernel capabilities.
            cgroup_parent (str): Override the default parent cgroup.
            cgroupns (str): Override the default cgroup namespace mode for the
                container. One of:
                - ``private`` the container runs in its own private cgroup
                  namespace.
                - ``host`` use the host system's cgroup namespace.
            cpu_count (int): Number of usable CPUs (Windows only).
            cpu_percent (int): Usable percentage of the available CPUs
                (Windows only).
            cpu_period (int): The length of a CPU period in microseconds.
            cpu_quota (int): Microseconds of CPU time that the container can
                get in a CPU period.
            cpu_rt_period (int): Limit CPU real-time period in microseconds.
            cpu_rt_runtime (int): Limit CPU real-time runtime in microseconds.
            cpu_shares (int): CPU shares (relative weight).
            cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
                ``0,1``).
            cpuset_mems (str): Memory nodes (MEMs) in which to allow execution
                (``0-3``, ``0,1``). Only effective on NUMA systems.
            detach (bool): Run container in the background and return a
                :py:class:`Container` object.
            device_cgroup_rules (:py:class:`list`): A list of cgroup rules to
                apply to the container.
            device_read_bps: Limit read rate (bytes per second) from a device
                in the form of: `[{"Path": "device_path", "Rate": rate}]`
            device_read_iops: Limit read rate (IO per second) from a device.
            device_write_bps: Limit write rate (bytes per second) from a
                device.
            device_write_iops: Limit write rate (IO per second) from a device.
            devices (:py:class:`list`): Expose host devices to the container,
                as a list of strings in the form
                ``<path_on_host>:<path_in_container>:<cgroup_permissions>``.

                For example, ``/dev/sda:/dev/xvda:rwm`` allows the container
                to have read-write access to the host's ``/dev/sda`` via a
                node named ``/dev/xvda`` inside the container.
            device_requests (:py:class:`list`): Expose host resources such as
                GPUs to the container, as a list of
                :py:class:`docker.types.DeviceRequest` instances.
            dns (:py:class:`list`): Set custom DNS servers.
            dns_opt (:py:class:`list`): Additional options to be added to the
                container's ``resolv.conf`` file.
            dns_search (:py:class:`list`): DNS search domains.
            domainname (str or list): Set custom DNS search domains.
            entrypoint (str or list): The entrypoint for the container.
            environment (dict or list): Environment variables to set inside
                the container, as a dictionary or a list of strings in the
                format ``["SOMEVARIABLE=xxx"]``.
            extra_hosts (dict): Additional hostnames to resolve inside the
                container, as a mapping of hostname to IP address.
            group_add (:py:class:`list`): List of additional group names and/or
                IDs that the container process will run as.
            healthcheck (dict): Specify a test to perform to check that the
                container is healthy. The dict takes the following keys:

                - test (:py:class:`list` or str): Test to perform to determine
                    container health. Possible values:

                    - Empty list: Inherit healthcheck from parent image
                    - ``["NONE"]``: Disable healthcheck
                    - ``["CMD", args...]``: exec arguments directly.
                    - ``["CMD-SHELL", command]``: Run command in the system's
                      default shell.

                    If a string is provided, it will be used as a ``CMD-SHELL``
                    command.
                - interval (int): The time to wait between checks in
                  nanoseconds. It should be 0 or at least 1000000 (1 ms).
                - timeout (int): The time to wait before considering the check
                  to have hung. It should be 0 or at least 1000000 (1 ms).
                - retries (int): The number of consecutive failures needed to
                    consider a container as unhealthy.
                - start_period (int): Start period for the container to
                    initialize before starting health-retries countdown in
                    nanoseconds. It should be 0 or at least 1000000 (1 ms).
            hostname (str): Optional hostname for the container.
            init (bool): Run an init inside the container that forwards
                signals and reaps processes
            init_path (str): Path to the docker-init binary
            ipc_mode (str): Set the IPC mode for the container.
            isolation (str): Isolation technology to use. Default: `None`.
            kernel_memory (int or str): Kernel memory limit
            labels (dict or list): A dictionary of name-value labels (e.g.
                ``{"label1": "value1", "label2": "value2"}``) or a list of
                names of labels to set with empty values (e.g.
                ``["label1", "label2"]``)
            links (dict): Mapping of links using the
                ``{'container': 'alias'}`` format. The alias is optional.
                Containers declared in this dict will be linked to the new
                container using the provided alias. Default: ``None``.
            log_config (LogConfig): Logging configuration.
            lxc_conf (dict): LXC config.
            mac_address (str): MAC address to assign to the container.
            mem_limit (int or str): Memory limit. Accepts float values
                (which represent the memory limit of the created container in
                bytes) or a string with a units identification char
                (``100000b``, ``1000k``, ``128m``, ``1g``). If a string is
                specified without a units character, bytes are assumed as an
                intended unit.
            mem_reservation (int or str): Memory soft limit.
            mem_swappiness (int): Tune a container's memory swappiness
                behavior. Accepts number between 0 and 100.
            memswap_limit (str or int): Maximum amount of memory + swap a
                container is allowed to consume.
            mounts (:py:class:`list`): Specification for mounts to be added to
                the container. More powerful alternative to ``volumes``. Each
                item in the list is expected to be a
                :py:class:`docker.types.Mount` object.
            name (str): The name for this container.
            nano_cpus (int):  CPU quota in units of 1e-9 CPUs.
            network (str): Name of the network this container will be connected
                to at creation time. You can connect to additional networks
                using :py:meth:`Network.connect`. Incompatible with
                ``network_mode``.
            network_disabled (bool): Disable networking.
            network_mode (str): One of:

                - ``bridge`` Create a new network stack for the container on
                  the bridge network.
                - ``none`` No networking for this container.
                - ``container:<name|id>`` Reuse another container's network
                  stack.
                - ``host`` Use the host network stack.
                  This mode is incompatible with ``ports``.

                Incompatible with ``network``.
            networking_config (Dict[str, EndpointConfig]):
                Dictionary of EndpointConfig objects for each container network.
                The key is the name of the network.
                Defaults to ``None``.

                Used in conjuction with ``network``.

                Incompatible with ``network_mode``.
            oom_kill_disable (bool): Whether to disable OOM killer.
            oom_score_adj (int): An integer value containing the score given
                to the container in order to tune OOM killer preferences.
            pid_mode (str): If set to ``host``, use the host PID namespace
                inside the container.
            pids_limit (int): Tune a container's pids limit. Set ``-1`` for
                unlimited.
            platform (str): Platform in the format ``os[/arch[/variant]]``.
                Only used if the method needs to pull the requested image.
            ports (dict): Ports to bind inside the container.

                The keys of the dictionary are the ports to bind inside the
                container, either as an integer or a string in the form
                ``port/protocol``, where the protocol is either ``tcp``,
                ``udp``, or ``sctp``.

                The values of the dictionary are the corresponding ports to
                open on the host, which can be either:

                - The port number, as an integer. For example,
                  ``{'2222/tcp': 3333}`` will expose port 2222 inside the
                  container as port 3333 on the host.
                - ``None``, to assign a random host port. For example,
                  ``{'2222/tcp': None}``.
                - A tuple of ``(address, port)`` if you want to specify the
                  host interface. For example,
                  ``{'1111/tcp': ('127.0.0.1', 1111)}``.
                - A list of integers, if you want to bind multiple host ports
                  to a single container port. For example,
                  ``{'1111/tcp': [1234, 4567]}``.

                Incompatible with ``host`` network mode.
            privileged (bool): Give extended privileges to this container.
            publish_all_ports (bool): Publish all ports to the host.
            read_only (bool): Mount the container's root filesystem as read
                only.
            remove (bool): Remove the container when it has finished running.
                Default: ``False``.
            restart_policy (dict): Restart the container when it exits.
                Configured as a dictionary with keys:

                - ``Name`` One of ``on-failure``, or ``always``.
                - ``MaximumRetryCount`` Number of times to restart the
                  container on failure.

                For example:
                ``{"Name": "on-failure", "MaximumRetryCount": 5}``

            runtime (str): Runtime to use with this container.
            security_opt (:py:class:`list`): A list of string values to
                customize labels for MLS systems, such as SELinux.
            shm_size (str or int): Size of /dev/shm (e.g. ``1G``).
            stdin_open (bool): Keep ``STDIN`` open even if not attached.
            stdout (bool): Return logs from ``STDOUT`` when ``detach=False``.
                Default: ``True``.
            stderr (bool): Return logs from ``STDERR`` when ``detach=False``.
                Default: ``False``.
            stop_signal (str): The stop signal to use to stop the container
                (e.g. ``SIGINT``).
            storage_opt (dict): Storage driver options per container as a
                key-value mapping.
            stream (bool): If true and ``detach`` is false, return a log
                generator instead of a string. Ignored if ``detach`` is true.
                Default: ``False``.
            sysctls (dict): Kernel parameters to set in the container.
            tmpfs (dict): Temporary filesystems to mount, as a dictionary
                mapping a path inside the container to options for that path.

                For example:

                .. code-block:: python

                    {
                        '/mnt/vol2': '',
                        '/mnt/vol1': 'size=3G,uid=1000'
                    }

            tty (bool): Allocate a pseudo-TTY.
            ulimits (:py:class:`list`): Ulimits to set inside the container,
                as a list of :py:class:`docker.types.Ulimit` instances.
            use_config_proxy (bool): If ``True``, and if the docker client
                configuration file (``~/.docker/config.json`` by default)
                contains a proxy configuration, the corresponding environment
                variables will be set in the container being built.
            user (str or int): Username or UID to run commands as inside the
                container.
            userns_mode (str): Sets the user namespace mode for the container
                when user namespace remapping option is enabled. Supported
                values are: ``host``
            uts_mode (str): Sets the UTS namespace mode for the container.
                Supported values are: ``host``
            version (str): The version of the API to use. Set to ``auto`` to
                automatically detect the server's version. Default: ``1.35``
            volume_driver (str): The name of a volume driver/plugin.
            volumes (dict or list): A dictionary to configure volumes mounted
                inside the container. The key is either the host path or a
                volume name, and the value is a dictionary with the keys:

                - ``bind`` The path to mount the volume inside the container
                - ``mode`` Either ``rw`` to mount the volume read/write, or
                  ``ro`` to mount it read-only.

                For example:

                .. code-block:: python

                    {'/home/user1/': {'bind': '/mnt/vol2', 'mode': 'rw'},
                     '/var/www': {'bind': '/mnt/vol1', 'mode': 'ro'}}

                Or a list of strings which each one of its elements specifies a
                mount volume.

                For example:

                .. code-block:: python

                    ['/home/user1/:/mnt/vol2','/var/www:/mnt/vol1']

            volumes_from (:py:class:`list`): List of container names or IDs to
                get volumes from.
            working_dir (str): Path to the working directory.

        Returns:
            The container logs, either ``STDOUT``, ``STDERR``, or both,
            depending on the value of the ``stdout`` and ``stderr`` arguments.

            ``STDOUT`` and ``STDERR`` may be read only if either ``json-file``
            or ``journald`` logging driver used. Thus, if you are using none of
            these drivers, a ``None`` object is returned instead. See the
            `Engine API documentation
            <https://docs.docker.com/engine/api/v1.30/#operation/ContainerLogs/>`_
            for full details.

            If ``detach`` is ``True``, a :py:class:`Container` object is
            returned instead.

        Raises:
            :py:class:`docker.errors.ContainerError`
                If the container exits with a non-zero exit code and
                ``detach`` is ``False``.
            :py:class:`docker.errors.ImageNotFound`
                If the specified image does not exist.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        rX   FrW   ÚplatformNz1.25TÚauto_removezQThe options 'detach' and 'remove' cannot be used together in api versions < 1.25.ÚnetworkÚnetwork_modezBThe options "network" and "network_mode" can not be used together.Únetworking_configzAThe option "networking_config" can not be used without "network".)r'   ÚcommandrW   )r™   r   Ú	LogConfigÚTypez	json-fileÚjournald)rO   rP   rX   ÚfollowÚ
StatusCoder   )rO   rP   r   r•   )r2   r   rA   Úpopr   r   r#   r?   Ú_versionÚRuntimeErrorÚcreater	   r$   Úpullr€   r   rn   r�   rv   r   Újoin)r   r'   rž   rO   rP   rv   rC   rX   rW   r™   Ú	containerÚlogging_driverÚoutÚexit_statuss                 r   ÚrunzContainerCollection.run  s=  € ôx	 �eœUÔ#Ø—H‘HˆEØ—‘˜H eÓ,ˆØ—‘˜H eÓ,ˆØ—:‘:˜j¨$Ó/ˆá‘fÜ˜4Ÿ;™;Ÿ?™?×3Ñ3°VÔ<Ø(,��}Ò%ä"ð $Nó Oð Oð �:‰:�iÔ  V§Z¡Z°Ô%?Üðóð ð
 �:‰:Ð)Ô*°6·:±:¸iÔ3HÜð%óð ð
	=Ø#˜Ÿ™ð =¨%¸Ø+1ñ=Ø5;ñ=ˆIð 	�‰ÔáØÐà"Ÿ™¨Ñ6°{ÑCÀFÑKˆàˆØ˜[Ò(¨N¸jÒ,HØ—.‘.Ø f°TÀ$ð !ó ˆCð  —n‘nÓ& |Ñ4ˆØ˜!ÒØˆCØ—:‘:˜mÔ,Ø—n‘n¨E¸$�nÓ?�áØ×ÑÔØ˜!ÒÜ Ø˜;¨°¸óð ñ �S�[ØˆJØ�x‰x˜‹}ÐøôC ò 	=Ø�K‰K×Ñ×#Ñ# E°HÐ#Ô=Ø#˜Ÿ™ð =¨%¸Ø+1ñ=Ø5;ñ=‹Ið	=ús   Ã-G ÇAHÈHc                 ó  — t        |t        «      r|j                  }||d<   ||d<   | j                  j                  j
                  |d<   t        |«      } | j                  j                  j                  di |¤Ž}| j                  |d   «      S )aà  
        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`
                If the specified image does not exist.
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        r'   rž   ÚversionrI   r•   )	r2   r   rA   r#   r?   r¥   Ú_create_container_argsÚcreate_containerr   )r   r'   rž   rC   Úcreate_kwargsrK   s         r   r§   zContainerCollection.create‘  s|   € ô  �eœUÔ#Ø—H‘HˆEØˆˆw‰Ø#ˆˆyÑØ ŸK™KŸO™O×4Ñ4ˆˆyÑÜ.¨vÓ6ˆØ/ˆt�{‰{�‰×/Ñ/Ñ@°-Ñ@ˆØ�x‰x˜˜T™
Ó#Ð#r   c                 ón   — | j                   j                  j                  |«      }| j                  |«      S )aƒ  
        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`
                If the server returns an error.
        )r#   r?   Úinspect_containerÚprepare_model)r   Úcontainer_idrK   s      r   r   zContainerCollection.getª  s-   € ð  �{‰{�‰×0Ñ0°Ó>ˆØ×!Ñ! $Ó'Ð'r   c                 ó$  — | j                   j                  j                  |||||¬«      }|r|D �	cg c]  }	| j                  |	«      ‘Œ c}	S g }
|D ]&  }		 |
j	                  | j                  |	d   «      «       Œ( |
S c c}	w # t        $ r |s‚ Y Œ>w xY w)af	  
        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 only container created before Id or Name,
                include non-running ones
            limit (int): Show `limit` last created containers, include
                non-running ones
            filters (dict): Filters to be processed on the image list.
                Available filters:

                - `exited` (int): Only containers with specified exit code
                - `status` (str): One of ``restarting``, ``running``,
                    ``paused``, ``exited``
                - `label` (str|list): format either ``"key"``, ``"key=value"``
                    or a list of such.
                - `id` (str): The id of the container.
                - `name` (str): The name of the container.
                - `ancestor` (str): Filter by container ancestor. Format of
                    ``<image-name>[:tag]``, ``<image-id>``, or
                    ``<image@digest>``.
                - `before` (str): Only containers created before a particular
                    container. Give the container name or id.
                - `since` (str): Only containers created after a particular
                    container. Give container name or id.

                A comprehensive list can be found in the documentation for
                `docker ps
                <https://docs.docker.com/engine/reference/commandline/ps>`_.

            sparse (bool): Do not inspect containers. Returns partial
                information, but guaranteed not to block. Use
                :py:meth:`Container.reload` on resulting objects to retrieve
                all attributes. Default: ``False``
            ignore_removed (bool): Ignore failures due to missing containers
                when attempting to inspect containers from the original list.
                Set to ``True`` if race conditions are likely. Has no effect
                if ``sparse=True``. Default: ``False``

        Returns:
            (list of :py:class:`Container`)

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        )ÚallÚbeforeÚfiltersÚlimitÚsincerI   )r#   r?   Ú
containersr¶   Úappendr   r
   )r   r¹   rº   r»   r¼   r½   ÚsparseÚignore_removedrK   Úrr¾   s              r   ÚlistzContainerCollection.list½  s¬   € ðh �{‰{�‰×)Ñ)¨c¸&Ø29ÀØ05ð *ó 7ˆñ Ø37Ö8¨a�D×&Ñ& qÕ)Ò8Ð8àˆJØò �ðØ×%Ñ% d§h¡h¨q°©wÓ&7Õ8ðð Ðùò 9øô  ò Ù)Øñ *ðús   ±A;Á#B Â BÂBc                 óN   — | j                   j                  j                  |¬«      S )N)r»   )r#   r?   Úprune_containers)r   r»   s     r   ÚprunezContainerCollection.prune  s   € Ø�{‰{�‰×/Ñ/¸Ð/Ó@Ð@r   )NTFFr�   )FNNéÿÿÿÿNFF)r�   r‘   r’   r   Úmodelr®   r§   r   rÃ   rÆ   r   rÅ   r“   r•   r   r   r—   r—     sJ   „ Ø€Eà;@Øóyóv$ò2(ð& JNØ*/óBóHAð ×.Ñ.×6Ñ6€E…Mr   r—   )rž   rW   Ú
domainnameÚ
entrypointrU   ÚhealthcheckÚhostnamer'   r.   Úmac_addressr   Únetwork_disabledr™   Ú
stdin_openÚstop_signalrR   Úuse_config_proxyrT   Úworking_dir)?rš   Úblkio_weight_deviceÚblkio_weightÚcap_addÚcap_dropÚcgroup_parentÚcgroupnsÚ	cpu_countÚcpu_percentÚ
cpu_periodÚ	cpu_quotaÚ
cpu_sharesÚcpuset_cpusÚcpuset_memsÚcpu_rt_periodÚcpu_rt_runtimeÚdevice_cgroup_rulesÚdevice_read_bpsÚdevice_read_iopsÚdevice_write_bpsÚdevice_write_iopsÚdevicesÚdevice_requestsÚdns_optÚ
dns_searchÚdnsÚextra_hostsÚ	group_addÚinitÚ	init_pathÚipc_modeÚ	isolationÚkernel_memoryÚlinksÚ
log_configÚlxc_confÚ	mem_limitÚmem_reservationÚmem_swappinessÚmemswap_limitÚmountsÚ	nano_cpusrœ   Úoom_kill_disableÚoom_score_adjÚpid_modeÚ
pids_limitrS   Úpublish_all_portsÚ	read_onlyÚrestart_policyÚsecurity_optÚshm_sizeÚstorage_optÚsysctlsÚtmpfsÚulimitsÚuserns_modeÚuts_moder°   Úvolume_driverÚvolumes_fromÚruntimec           	      ó¤  — i }t        j                   | «      D ]  }|t        v sŒ| j                  |«      ||<   Œ! i }t        j                   | «      D ]  }|t        v sŒ| j                  |«      ||<   Œ! | j                  di «      }|r||d<   | j                  di «      }|r||d<   | j                  dd«      }| j                  dd«      }|r!|r||vrd}|rt	        |«      n|di|d<   ||d<   | rt        d	| «      ‚t        di |¤Ž|d
<   |d
   j                  d«      }|rCt        |j                  «       «      D �	cg c]  }	t        |	j                  dd«      «      ‘Œ c}	|d<   |r^t        |t        «      r2|j                  «       D �
cg c]  }
|
j                  d«      ‘Œ c}
|d<   |S |D �
cg c]  }
t        |
«      ‘Œ c}
|d<   |S c c}	w c c}
w c c}
w )zK
    Convert arguments to create() to arguments to create_container().
    r=   Úport_bindingsÚvolumesÚbindsr›   Nr�   rœ   r®   Úhost_configÚPortBindingsr   r   Úbindr•   )ÚcopyÚRUN_CREATE_KWARGSr¤   ÚRUN_HOST_CONFIG_KWARGSr   r   r   r   ÚsortedÚkeysÚtupler%   r2   r3   ÚvaluesÚ_host_volume_from_bind)rC   r³   ÚkeyÚhost_config_kwargsr=   r  r›   r�   r  ÚpÚvs              r   r±   r±   b  s  € ð
 €MÜ�y‰y˜Ó ò 1ˆØÔ#Ò#Ø!'§¡¨C£ˆM˜#Òð1ð ÐÜ�y‰y˜Ó ò 6ˆØÔ(Ò(Ø&,§j¡j°£oÐ˜sÒ#ð6ð
 �J‰J�w Ó#€EÙØ.3Ð˜?Ñ+à�j‰j˜ BÓ'€GÙØ&-Ð˜7Ñ#à�j‰j˜ DÓ)€GØŸ
™
Ð#6¸Ó=ÐÙÙð Ð/Ñ/Ø$(Ð!ñ ô .>Øô.
à%,¨d Oð 	Ð)Ñ*ð .5Ð˜>Ñ*ñ Ü,¨U°FÓ;Ð;ä#-Ñ#CÐ0BÑ#C€M�-Ñ ð " -Ñ0×4Ñ4°^ÓD€MÙô ,2°-×2DÑ2DÓ2FÓ+Gö"IØ&'ô #(¨¯©°°Q«Õ"8ò "Iˆ�gÑáÜ�gœtÔ$à'.§~¡~Ó'7ö(Ø"#�—‘�f•ò(ˆM˜)Ñ$ð Ðð 4;ö(Ø./Ô& qÕ)ò(ˆM˜)Ñ$ð Ðùò"Iùò(ùò(s   Ä9"GÆGÆ)Gc                 óú   — t        j                  | «      \  }}|j                  dd«      }t        |«      dk(  s|d   dv r||d   z   S |d   j	                  d«      s|d   j	                  d«      r|d   d d S |d   S )Nr"   r   )ÚroÚrwr   z:roz:rwéýÿÿÿ)ÚntpathÚ
splitdriver%   ÚlenÚendswith)r  ÚdriveÚrestÚbitss       r   r  r     s†   € Ü×#Ñ# DÓ)�K€Eˆ4Ø�:‰:�c˜1Ó€DÜ
ˆ4ƒy�A‚~˜˜a™ LÑ0Ø�t˜A‘w‰ÐØ	ˆa‰×	Ñ	˜%Ô	  D¨¡G×$4Ñ$4°UÔ$;Ø�A‰w�s˜ˆ|Ðà�A‰wˆr   r^   zexit_code,output)r  r%  Úcollectionsr   r?   r   Ú	constantsr   Úerrorsr   r   r	   r
   r   Útypesr   r   Úutilsr   r$   r   Úresourcer   r   r   r—   r  r  r±   r  r^   r•   r   r   ú<module>r2     s{   ðÛ Û Ý "å Ý /÷õ ÷ 1Ý Ý ß 'ô|7�ô |7ô~q7˜*ô q7òjÐ ò.@Ð òF;ò|ñ ˜Ð&8Ó9€
ðr   