Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/freetwilight/docker
The docker python client supports asynchronous parallel access to containers.
https://github.com/freetwilight/docker
client containers docker docker-api docker-client docker-compose engine-api
Last synced: about 1 month ago
JSON representation
The docker python client supports asynchronous parallel access to containers.
- Host: GitHub
- URL: https://github.com/freetwilight/docker
- Owner: FreeTwilight
- License: apache-2.0
- Created: 2024-08-09T13:42:44.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-15T11:18:50.000Z (3 months ago)
- Last Synced: 2024-10-11T13:01:06.714Z (about 1 month ago)
- Topics: client, containers, docker, docker-api, docker-client, docker-compose, engine-api
- Language: Python
- Homepage: https://docs.docker.com/engine/api/
- Size: 58.6 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://docs.docker.com/manuals/).# Installation
The latest stable version is available on PyPI. Install with pip:
```
pip install docker-sdk
```# Usage
### 1. Example docker client
```
import asyncio,time
import sys,os,jsonfrom docker.client import Client
async def main():
client = Client("172.16.80.42","2376")
try:
ret = await client.images.list(params = {"all":"true"})
print(json.dumps(ret,ensure_ascii = False,indent=4))
finally:
await client.close()
asyncio.run(main())
```### 2. Example docker run
```
import asyncio,time
import sys,os,jsonfrom 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())
```
### 3. Example docker list
```
import asyncio,time
import sys,os,jsonfrom 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())
```