aiodocker


Nameaiodocker JSON
Version 0.24.0 PyPI version JSON
download
home_pageNone
SummaryA simple Docker HTTP API wrapper written with asyncio and aiohttp.
upload_time2024-11-21 02:23:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9.0
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==============================
AsyncIO bindings for docker.io
==============================

.. image:: https://badge.fury.io/py/aiodocker.svg
   :target: https://badge.fury.io/py/aiodocker
   :alt: PyPI version

.. image:: https://img.shields.io/pypi/pyversions/aiodocker.svg
   :target: https://pypi.org/project/aiodocker/
   :alt: Python Versions

.. image:: https://github.com/aio-libs/aiodocker/actions/workflows/ci-cd.yml/badge.svg?branch=master
   :target: https://github.com/aio-libs/aiodocker/actions/workflows/ci-cd.yml?query=branch%3Amaster
   :alt: GitHub Actions status for the main branch

.. image:: https://codecov.io/gh/aio-libs/aiodocker/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/aio-libs/aiodocker
   :alt: Code Coverage

.. image:: https://badges.gitter.im/Join%20Chat.svg
    :target: https://gitter.im/aio-libs/Lobby
    :alt: Chat on Gitter


A simple Docker HTTP API wrapper written with asyncio and aiohttp.


Installation
============

.. code-block:: sh

   pip install aiodocker


Development
===========

Create a virtualenv (either using ``python -m venv``, ``pyenv`` or your
favorite tools) and install in the editable mode with ``ci`` and ``dev`` optional
dependency sets.

.. code-block:: sh

   pip install -U pip
   pip install -e '.[ci,dev]'  # in zsh, you need to escape brackets
   pre-commit install

Running tests
~~~~~~~~~~~~~

.. code-block:: sh

   # Run all tests
   make test

   # Run individual tests
   python -m pytest tests/test_images.py


Building packages
~~~~~~~~~~~~~~~~~

NOTE: Usually you don't need to run this step by yourself.

.. code-block:: sh

   pip install -U build
   python -m build --sdist --wheel


Documentation
=============

http://aiodocker.readthedocs.io


Examples
========

.. code-block:: python

    import asyncio
    import aiodocker

    async def list_things(docker):
        print('== Images ==')
        for image in (await docker.images.list()):
            tags = image['RepoTags'][0] if image['RepoTags'] else ''
            print(image['Id'], tags)
        print('== Containers ==')
        for container in (await docker.containers.list()):
            print(f" {container._id}")

    async def run_container(docker):
        print('== Running a hello-world container ==')
        container = await docker.containers.create_or_replace(
            config={
                'Cmd': ['/bin/ash', '-c', 'echo "hello world"'],
                'Image': 'alpine:latest',
            },
            name='testing',
        )
        await container.start()
        logs = await container.log(stdout=True)
        print(''.join(logs))
        await container.delete(force=True)

    async def main():
        docker = aiodocker.Docker()
        await list_things(docker)
        await run_container(docker)
        await docker.close()

    if __name__ == "__main__":
        asyncio.run(main())

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aiodocker",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9.0",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f2/d7/30104dfac550ae6570d4dce24c2cbf2ddefd4937c9e861641314abfd8abb/aiodocker-0.24.0.tar.gz",
    "platform": null,
    "description": "==============================\nAsyncIO bindings for docker.io\n==============================\n\n.. image:: https://badge.fury.io/py/aiodocker.svg\n   :target: https://badge.fury.io/py/aiodocker\n   :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/aiodocker.svg\n   :target: https://pypi.org/project/aiodocker/\n   :alt: Python Versions\n\n.. image:: https://github.com/aio-libs/aiodocker/actions/workflows/ci-cd.yml/badge.svg?branch=master\n   :target: https://github.com/aio-libs/aiodocker/actions/workflows/ci-cd.yml?query=branch%3Amaster\n   :alt: GitHub Actions status for the main branch\n\n.. image:: https://codecov.io/gh/aio-libs/aiodocker/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/aio-libs/aiodocker\n   :alt: Code Coverage\n\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n    :target: https://gitter.im/aio-libs/Lobby\n    :alt: Chat on Gitter\n\n\nA simple Docker HTTP API wrapper written with asyncio and aiohttp.\n\n\nInstallation\n============\n\n.. code-block:: sh\n\n   pip install aiodocker\n\n\nDevelopment\n===========\n\nCreate a virtualenv (either using ``python -m venv``, ``pyenv`` or your\nfavorite tools) and install in the editable mode with ``ci`` and ``dev`` optional\ndependency sets.\n\n.. code-block:: sh\n\n   pip install -U pip\n   pip install -e '.[ci,dev]'  # in zsh, you need to escape brackets\n   pre-commit install\n\nRunning tests\n~~~~~~~~~~~~~\n\n.. code-block:: sh\n\n   # Run all tests\n   make test\n\n   # Run individual tests\n   python -m pytest tests/test_images.py\n\n\nBuilding packages\n~~~~~~~~~~~~~~~~~\n\nNOTE: Usually you don't need to run this step by yourself.\n\n.. code-block:: sh\n\n   pip install -U build\n   python -m build --sdist --wheel\n\n\nDocumentation\n=============\n\nhttp://aiodocker.readthedocs.io\n\n\nExamples\n========\n\n.. code-block:: python\n\n    import asyncio\n    import aiodocker\n\n    async def list_things(docker):\n        print('== Images ==')\n        for image in (await docker.images.list()):\n            tags = image['RepoTags'][0] if image['RepoTags'] else ''\n            print(image['Id'], tags)\n        print('== Containers ==')\n        for container in (await docker.containers.list()):\n            print(f\" {container._id}\")\n\n    async def run_container(docker):\n        print('== Running a hello-world container ==')\n        container = await docker.containers.create_or_replace(\n            config={\n                'Cmd': ['/bin/ash', '-c', 'echo \"hello world\"'],\n                'Image': 'alpine:latest',\n            },\n            name='testing',\n        )\n        await container.start()\n        logs = await container.log(stdout=True)\n        print(''.join(logs))\n        await container.delete(force=True)\n\n    async def main():\n        docker = aiodocker.Docker()\n        await list_things(docker)\n        await run_container(docker)\n        await docker.close()\n\n    if __name__ == \"__main__\":\n        asyncio.run(main())\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "A simple Docker HTTP API wrapper written with asyncio and aiohttp.",
    "version": "0.24.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c5b2bb8b632041e314a0a917ade80382ca6a8f331f12c7eb409e59cd0485cc9",
                "md5": "472884e04ac9d20eb48c8d27c9a28989",
                "sha256": "2199b7b01f8ce68f9cabab7910ecb26192f6f3494163f1ccffe527b4c3875689"
            },
            "downloads": -1,
            "filename": "aiodocker-0.24.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "472884e04ac9d20eb48c8d27c9a28989",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9.0",
            "size": 34849,
            "upload_time": "2024-11-21T02:23:58",
            "upload_time_iso_8601": "2024-11-21T02:23:58.053797Z",
            "url": "https://files.pythonhosted.org/packages/0c/5b/2bb8b632041e314a0a917ade80382ca6a8f331f12c7eb409e59cd0485cc9/aiodocker-0.24.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2d730104dfac550ae6570d4dce24c2cbf2ddefd4937c9e861641314abfd8abb",
                "md5": "963c6fe078c82ebe98c925da1aff17fb",
                "sha256": "661a6f9a479951f11f793031dcd5d55337e232c4ceaee69d51ceb885e5f16fac"
            },
            "downloads": -1,
            "filename": "aiodocker-0.24.0.tar.gz",
            "has_sig": false,
            "md5_digest": "963c6fe078c82ebe98c925da1aff17fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9.0",
            "size": 135482,
            "upload_time": "2024-11-21T02:23:59",
            "upload_time_iso_8601": "2024-11-21T02:23:59.642777Z",
            "url": "https://files.pythonhosted.org/packages/f2/d7/30104dfac550ae6570d4dce24c2cbf2ddefd4937c9e861641314abfd8abb/aiodocker-0.24.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 02:23:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "aiodocker"
}
        
Elapsed time: 0.33205s