AsyncIO bindings for docker.io
A simple Docker HTTP API wrapper written with asyncio and aiohttp.
Installation
pip install aiodocker
Documentation
Examples
import asyncio
import aiodocker
async def list_things():
docker = aiodocker.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}")
await docker.close()
async def run_container():
docker = aiodocker.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)
await docker.close()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(list_things())
loop.run_until_complete(run_container())
loop.close()
Changes
0.18.1 (2020-04-01)
Bugfixes
Improve the errror message when connection is closed by Docker Engine on TCP hijacking. (#424)
0.18.0 (2020-03-25)
Features
Improve the error text message if cannot connect to docker engine. (#411)
Rename websocket() to attach() (#412)
Implement docker exec protocol. (#415)
Implement container commit, pause and unpause functionality. (#418)
Implement auto-versioning of the docker API by default. (#419)
Bugfixes
Fix volume.delete throwing a TypeError. (#389)
0.17.0 (2019-10-15)
Bugfixes
Fixed an issue when the entire tar archive was stored in RAM while building the image. (#352)
0.16.0 (2019-09-23)
Bugfixes
Fix streaming mode for pull, push, build, stats and events. (#344)
0.15.0 (2019-09-22)
Features
Add support for Docker 17.12.1 and 18.03.1 (#164)
Add initial support for nodes. (#181)
Add initial support for networks. (#189)
Add support for docker info ando docker swarm join. (#193)
Add restart method for containers. (#200)
Feature: Add support for registry-auth when you create a service. (#215)
Feature: Add support for docker save and load api methods (#219)
Pass params to docker events. (#223)
Add ability to get a Docker network by name or ID. (#279)
Always close response after processing, make .logs(…, follow=True) async iterator. (#341)
Bugfixes
Fix: Set timeout for docker events to 0 (no timeout) (#115)
Fix: prevents multiple listener tasks to be created automatically (#116)
Fix: if container.start() fails user won’t get the id of the container (#128)
Improve logging when docker socket not available. (#155)
Fix current project version. (#156)
Fix update out of sequence. (#169)
Remove asserts used to check auth with docker registry. (#172)
Fix: fix to parse response of docker load method as a json stream (#222)
Fix: Handle responses with 0 or missing Content-Length (#237)
Fix: don’t remove non-newline whitespace from multiplexed lines (#246)
Fix docker_context.tar error (#253)
Deprecations and Removals
docker.images.get has been renamed to docker.images.inspect, remove support for Docker 17.06 (#164)
Drop Python 3.5 (#338)
Drop deprecated container.copy() (#339)
Misc
#28, #167, #192, #286
Metadata
Release files for aiodocker 0.18.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 | |
|---|---|---|---|
| aiodocker-0.18.4.tar.gz | 481.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiodocker-0.18.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 515.0 kB
Release files / aiodocker-0.18.4.tar.gz
| Download URL | aiodocker-0.18.4.tar.gz |
|---|---|
| Size | 481.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16c06305ae39ab1171ffec5cfefc338187645eb1890638230a6e5f7aec96a42c
|
|
BLAKE2b-256 checksum How to use checksums |
ea29ae3db5fe44b631485489213d0595cc79e3e152358c09c77cd978a097cf1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Release files / aiodocker-0.18.4-py3-none-any.whl
| Download URL | aiodocker-0.18.4-py3-none-any.whl |
|---|---|
| Size | 33.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00af1cd68908278bae9e9c7338955be847b718afc2f7893a80c29f9536a04ee4
|
|
BLAKE2b-256 checksum How to use checksums |
46266425ce6c349b143d5707315871fad8757d36f6613d1c8c8d3fe22ecc026f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|