Skip to main content

The docker python client supports asynchronous parallel access to containers.

Project description

Docker SDK for Python

The docker python client supports asynchronous parallel access to containers.

Develop with Docker Engine SDKs Docker provides an API for interacting with the Docker daemon (called the Docker Engine API), as well as SDKs for Go and Python. The SDKs allow you to efficiently build and scale Docker apps and solutions. If Go or Python don't work for you, you can use the Docker Engine API directly.

Reference Docs

This site was built using Dokcer Docs manuals.

Installation

The latest stable version is available on PyPI. Install with pip:

pip install docker-sdk

Usage

1. Example docker run

import asyncio,time
import sys,os,json

from docker.containers import Containers

async def main():
    containers = Containers("172.16.80.42","2376")
    await containers.init_session()
    try:

        ret = await containers.run(params={ "name": "hello9"},body = {'Image': 'searxng/searxng:latest'})
        print(json.dumps(ret,ensure_ascii = False,indent=4))
        
    finally:
        await containers.close()

    
asyncio.run(main())

2. Example docker list

import asyncio,time
import sys,os,json

from  docker.containers  import Containers

async def main():
    containers = Containers("172.16.80.42","2376")
    await containers.init_session()
    try:
        ret = await containers.list(params = {"all":"true"})
        print(json.dumps(ret,ensure_ascii = False,indent=4))
        
    finally:
        await containers.close()

    
asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docker-sdk-1.0.4.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docker_sdk-1.0.4-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file docker-sdk-1.0.4.tar.gz.

File metadata

  • Download URL: docker-sdk-1.0.4.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for docker-sdk-1.0.4.tar.gz
Algorithm Hash digest
SHA256 78140c5b537b856769e738f25506e129627383c04ff7bbdbb86784c46a351f40
MD5 12bc7a8bb7e93a2e817090ddc8e3d7c2
BLAKE2b-256 fa67b9294c0ac3b9e8e2a905b3e30271096d64682bec9a32332405f62d6597f6

See more details on using hashes here.

File details

Details for the file docker_sdk-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: docker_sdk-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for docker_sdk-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 65e2f3a4ed6d5fd0a0527de7cd213cdba348ce4837be06af1cdc1d3249c5f8c4
MD5 ff03224a48957bf60ffbfa3e85f568cc
BLAKE2b-256 1456f9e2503dc0e7ad2555196503d58b56d3d766b40354d6aba30ff46cefa07d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page