Skip to content
/ swarm Public

A swarm cluster manager based on the Python docker API

License

Notifications You must be signed in to change notification settings

FNNDSC/swarm

Repository files navigation

Swarm

A swarm cluster manager based on the Python docker API

https://travis-ci.org/FNNDSC/swarm.svg?branch=master

The docker image can be run from a swarm manager to schedule a service:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock fnndsc/swarm swarm.py -s test -i alpine -c "echo test"

This will schedule the test service that runs command:

echo test

using the Alpine image

The same thing can be accomplished from Python code:

client = docker.from_env()
# 'remove' option automatically remove container when finished
byte_str = client.containers.run('fnndsc/swarm',  'swarm.py -s test -i alpine -c "echo test"',
                                 volumes={'/var/run/docker.sock': {'bind': '/var/run/docker.sock', 'mode': 'rw'}},
                                 remove=True)

To remove the test service:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock fnndsc/swarm swarm.py --remove test

or from Python:

byte_str = client.containers.run('fnndsc/swarm',  'swarm.py --remove test',
                                 volumes={'/var/run/docker.sock': {'bind': '/var/run/docker.sock', 'mode': 'rw'}},
                                 remove=True)

About

A swarm cluster manager based on the Python docker API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •