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())
Metadata
Release files for docker-sdk 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| docker-sdk-1.0.4.tar.gz | 27.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| docker_sdk-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.0 kB
Release files / docker-sdk-1.0.4.tar.gz
| Download URL | docker-sdk-1.0.4.tar.gz |
|---|---|
| Size | 27.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78140c5b537b856769e738f25506e129627383c04ff7bbdbb86784c46a351f40
|
|
BLAKE2b-256 checksum How to use checksums |
fa67b9294c0ac3b9e8e2a905b3e30271096d64682bec9a32332405f62d6597f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / docker_sdk-1.0.4-py3-none-any.whl
| Download URL | docker_sdk-1.0.4-py3-none-any.whl |
|---|---|
| Size | 32.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65e2f3a4ed6d5fd0a0527de7cd213cdba348ce4837be06af1cdc1d3249c5f8c4
|
|
BLAKE2b-256 checksum How to use checksums |
1456f9e2503dc0e7ad2555196503d58b56d3d766b40354d6aba30ff46cefa07d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|