Fabric for docker containers
Latest commit 14e9194 Jan 19, 2015 @klizhentas klizhentas Merge pull request #11 from glyph/master
Remove remaining use of * imports.



Shipper is a fabric for docker - tool for orchestrating docker containers. Supports parallel execution and can generate command line interface.


from shipper import Shipper, run, command

def hello():
   print Shipper().containers(pretty=True)


Now your file is a fully functional command line tool that talks to local docker!

python hello.py -h
python hello.py hello -h
python hello.py hello

The fun part is you can turn your tiny hello.py to a massive scale docker client in 1 change:

print Shipper(["host-a", "host-b", "host-c", "host-d"]).containers(pretty=True)

All the steps would be executed in parallel.

More complex example:

from shipper import Shipper, run, command

def build(tag, path):
    s = Shipper()
    s.build(tag=tag, path=path)

def ps(all=False, running=True):
    s = Shipper(["host-a", "host-b"])
    print s.containers(pretty=True, all=all, running=running)

def start(image, command, ports=None):
    if ports:
        ports = ports.split(",")
    s = Shipper()
    s.run(image, command, ports=ports, once=True)

def stop(image=None):
    s = Shipper()
    s.stop(*s.containers(image=image, running=True))


Now you can use the env.py file as your command line tool, shipper has generated the command line interface.

python env.py ps --all
python env.py build base ~/images/base
python env.py build stop --image dev/.*


git clone git@github.com:mailgun/shipper.git
cd shipper
python setup.py install


Undergoing development. Is already useful for building dev environments.