Skip to content

tianon/aiodocker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsyncIO bindings for docker.io

Example:

#!/usr/bin/env python3

import asyncio
from aiodocker.docker import Docker

loop = asyncio.get_event_loop()
docker = Docker("http://localhost:4243/")


@asyncio.coroutine
def handler(events):
    queue = events.listen()
    container = yield from docker.containers.run(config, name='testing')
    while True:
        event = yield from queue.get()
        if event['status'] == 'create':
            yield from event['container'].stop()
            print("Killed {id} so hard".format(**event))


events = docker.events
tasks = [asyncio.async(events.run()),
         asyncio.async(handler(events)),]

loop.run_until_complete(asyncio.gather(*tasks))

About

Docker AsyncIO

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%