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
Release history Release notifications | RSS feed
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.3.tar.gz
(27.5 kB
view hashes)
Built Distribution
docker_sdk-1.0.3-py3-none-any.whl
(32.6 kB
view hashes)
Close
Hashes for docker_sdk-1.0.3-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 8706a18d91b8ac88c690d436b36f6f7f3834a90b9c8089495a50f4bda55252da |
|
| MD5 | 73b1917d65c75afb98fe7442a5db5474 |
|
| BLAKE2b-256 | 98be1629b96c4df6c2787656bc7aa0dd0d9de861c0f88f9b1fc18e1330fc8e6d |