All Projects → mailgun → Shipper

mailgun / Shipper

Licence: apache-2.0
Fabric for docker containers

Programming Languages

python
139335 projects - #7 most used programming language

Shipper

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

hello.py:

from shipper import Shipper, run, command

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

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

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

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

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

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

run()

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/.*

Setup

git clone [email protected]:mailgun/shipper.git
cd shipper
python setup.py install

Status

Undergoing development. Is already useful for building dev environments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].