Usage

class machine.machine.Machine(path='docker-machine')
active()

Print which machine is active

Returns:a list of machines that are active
Return type:List[str]
config(machine='default')

Returns the docker configuration for the given machine.

Parameters:machine – The machine name
Returns:base_url, tls
Return type:dict
create(name, driver='virtualbox', blocking=True)

Create a docker machine using the provided name and driver NOTE: This takes a loooooong time

Parameters:
  • name (str) – the name to give to the machine (must be unique)
  • driver – the driver to use to create the machine
  • blocking (bool) – should wait for completion before exiting
Returns:

error code from the run

Return type:

int

env(machine='default')

Get the environment variables to configure docker to connect to the specified docker machine.

Parameters:machine (str) – the name of the machine
Returns:A set of environment variables
Return type:str
exists(machine='default')

Checks if machine exists.

Parameters:machine (str) – name of the machine
Returns:bool
inspect(machine='default')

Inspect information about a machine.

Parameters:machine (str) – the name of the machine
Returns:A nested dicht with inspect information about the machine.
Return type:dict
ip(machine='default')

Get the IP address of a machine.

Parameters:machine (str) – the name of the machine
Returns:the IP address of a machine.
Return type:str
kill(machine='default')

Kill a machine

Parameters:machine (str) – the name of the machine
Returns:True if successful
Return type:bool
ls()

List machines.

Returns:of machines
Return type:list
provision(machine='default')

Provision the specified machine.

Parameters:machine (str) – the name of the machine
Returns:True if successful
Return type:bool
regenerate_certs(machine='default')

Regenerate certificats for the specified machine.

Parameters:machine (str) – the name of the machine
Returns:True if successful
Return type:bool
restart(machine='default')

Restart a machine

Parameters:machine (str) – the name of the machine
Returns:True if successful
Return type:bool
rm(machine='default', force=False)

Remove the specified machine.

Parameters:
  • machine (str) – the name of the machine
  • force (bool) – Remove local configuration even if machine cannot be removed
Returns:

True if successful

Return type:

bool

scp(source, destination, recursive=False)

Copy files between machines

Parameters:
  • source (str) – [machine:][path]
  • destination (str) – [machine:][path]
  • recursive (bool) – Copy files recursively (required to copy directories)
Returns:

output of the scp command

Return type:

List[str}

ssh(machine, cmd)

Run a command on a machine through docker-machine ssh

Parameters:
  • machine (str) – machine name
  • cmd (str) – command to run
Returns:

output of the ssh command

Return type:

List[str]

start(machine='default')

Start the specified machine.

Parameters:machine (str) – the name of the machine
Returns:True if successful
Return type:bool
status(machine='default')

Get the status for the machine.

Parameters:machine (str) – the name of the machine
Returns:status of machine
Return type:bool
stop(machine='default')

Stop the specified machine.

Parameters:machine (str) – the name of the machine
upgrade(machine='default')

Upgrade a machine

Parameters:machine (str) – the name of the machine
Returns:True if successful
Return type:bool
url(machine='default')

Get the URL of a machine

Parameters:machine (str) – the name of the machine
Returns:the URL of a machine
Return type:str
version()

Get the docker-machine binary version.

Returns:the docker-machine binary version
Return type:str