Giter VIP home page Giter VIP logo

python-docker-machine's Introduction

python-docker-machine

Pythonic wrapper around docker-machine

installation

$ python setup.py install

or:

$ pip install python-docker-machine

usage

Documentation Status
import machine
import docker
m = machine.Machine(path="/usr/local/bin/docker-machine")
client = docker.APIClient(**m.config(machine='default'))
client.ping()

requirements

docker-machine on your system path

https://docs.docker.com/machine/install-machine/

running the test suite

Make sure docker-machine is available on your system path. Next you need to create a docker machine with the name python-docker-machine with the driver of your choice, for example the virtualbox driver:

$ docker-machine create -d virtualbox python-docker-machine

Now you can run the tests with nose:

$  nosetests
......................
----------------------------------------------------------------------
Ran 22 tests in 0.262s

or with tox:

$ tox

python-docker-machine's People

Contributors

akihirosuda avatar am97 avatar eagafonov avatar gijzelaerr avatar gjagtap avatar kodsama avatar mjbright avatar petrenva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-docker-machine's Issues

No token argument when create server

Hi

Is there any way to add token argument for a driver ?

m.create('test-d', driver='digitalocean', blocking=True)
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/site-packages/machine/machine.py", line 104, in create
stdout, stderr, errorcode = self._run_blocking(cmd)
File "/usr/local/lib/python3.6/site-packages/machine/machine.py", line 56, in _run_blocking
raise RuntimeError("cmd returned error %s: %s" % (error_code, stderr.decode('utf-8').strip()))
RuntimeError: cmd returned error 1: Error setting machine configuration from flags provided: digitalocean driver requires the --digitalocean-access-token option

Get output from docker-machine when running commands

How would one be able to render the output from the docker-machine commands back to sysout when running the various commands?

I'm writing a CLI that uses your excellent little library, but doing things like creating and provisioning can take a long time without any feedback via your library even though there is some progress when running directly from docker-machine.

Machine.ls() generate buggy last entry `{'Name': u''}`

Machine.ls() generate buggy last entry {'Name': u''}

In [18]: machine.Machine().ls()
Out[18]: 
[{'Active': '-', 'Name': 'python-docker-machine', .... },
 {'Active': '-', 'Name': 'swarm-1', .... },
 {'Active': '-', 'Name': 'swarm-2',... },
 {'Active': '-', 'Name': 'swarm-3', .... },
 {'Name': ''}]

It comes from empty line after stdout.split("\n") at

for line in stdout.split("\n"):

In [15]: '1\n2\n'.split('\n')
Out[15]: ['1', '2', '']

lines split result need to filtered in order to drop last
empty-string-entry

PR will come shortly

fix travis build

At the moment we cannot use docker-machine on travis, due to an issue with docker-machine:

docker/machine#1435

Until this is fixed we cannot run the test suite on travis.

create vm blocking and non_blocking are working same.

create vm,

  1. blocking : it will block till vm is created.
  2. non bloxking : it will create vm in parallel, and return.

In current implementation , after popen, we communicate, it will wait internally. there is no point for adding extra wait call.

I think non blocking is not yet implementation

for reference https://docs.python.org/3.4/library/subprocess.html
Popen.communicate(input=None, timeout=None)
Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be data to be sent to the child process, or None, if no data should be sent to the child. The type of input must be bytes or, if universal_newlines was True, a string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.