All Projects → vweevers → node-docker-machine

vweevers / node-docker-machine

Licence: MIT license
Programmatic API to Docker Machine.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-docker-machine

Docker Machine Driver Hetzner
Docker machine driver for the new hetzner cloud API
Stars: ✭ 308 (+1366.67%)
Mutual labels:  machine, docker-machine
playing-docker-swarm-docker-machine
Scripts to help you to play with Docker Swarm and Docker Machine
Stars: ✭ 19 (-9.52%)
Mutual labels:  docker-machine
rig
Outrigger command line tool
Stars: ✭ 13 (-38.1%)
Mutual labels:  docker-machine
zAnalysis
zAnalysis是基于Pascal语言编写的大型统计学开源库
Stars: ✭ 52 (+147.62%)
Mutual labels:  machine
docker-machine-driver-vultr
Vultr Driver Plugin for Docker Machine
Stars: ✭ 20 (-4.76%)
Mutual labels:  docker-machine
thesaurus
TT Hackathon 2018 - Autocomplete for Visual Programming Nodes
Stars: ✭ 23 (+9.52%)
Mutual labels:  machine
algorithmia
No description or website provided.
Stars: ✭ 15 (-28.57%)
Mutual labels:  machine
terraform-provider-dockermachine
Docker machine provider for Terraform
Stars: ✭ 20 (-4.76%)
Mutual labels:  docker-machine
Hello-Kaggle-Guide-KOR
Kaggle을 처음 접하는 사람들을 위한 문서
Stars: ✭ 140 (+566.67%)
Mutual labels:  machine
l1vm
L1VM - a tiny virtual machine with a 64 bit core
Stars: ✭ 112 (+433.33%)
Mutual labels:  machine
IndyMill
Open Source DIY Metal CNC Machine
Stars: ✭ 85 (+304.76%)
Mutual labels:  machine
jvm-development-environment
A Vagrant controlled software development environment built around IntelliJ IDEA, PyCharm, Docker and Ubuntu.
Stars: ✭ 42 (+100%)
Mutual labels:  docker-machine
docker-machine-mac-nfs-mount
Docker machine Mac OS X nfs mount
Stars: ✭ 17 (-19.05%)
Mutual labels:  docker-machine
knime-r
KNIME Interactive R Statistics Integration
Stars: ✭ 18 (-14.29%)
Mutual labels:  machine
node-docker-share
Share local folders with a Docker Machine VM
Stars: ✭ 30 (+42.86%)
Mutual labels:  docker-machine
parallel-corpora-tools
Tools for filtering and cleaning parallel and monolingual corpora for machine translation and other natural language processing tasks.
Stars: ✭ 35 (+66.67%)
Mutual labels:  machine
FiniteStateMachine
This project is a finite state machine designed to be used in games.
Stars: ✭ 45 (+114.29%)
Mutual labels:  machine
machine learning examples
machine_learning_examples
Stars: ✭ 68 (+223.81%)
Mutual labels:  machine
docker-workshop
Workshop on Docker, Containers and Golang
Stars: ✭ 20 (-4.76%)
Mutual labels:  docker-machine
landmap
Landmap package for R
Stars: ✭ 33 (+57.14%)
Mutual labels:  machine

docker-machine

Programmatic API to Docker Machine (0.6.0+).
Wraps the docker-machine CLI.

node npm status Travis build status AppVeyor build status Dependency status JavaScript Style Guide

Table of Contents

Click to expand

Example

node example.js ls /

const Machine = require('docker-machine')
const cmd = process.argv.slice(2)
const machine = new Machine()

// Start if not already started
machine.start(function (err) {
  if (err) throw err

  // Execute a command
  machine.ssh(cmd, (err, result) => {
    if (err) throw err
    console.log(result)
  })
})

API

new Machine([name || opts])

Options:

  • name: defaults to DOCKER_MACHINE_NAME or "default"

machine.status((err, status) => ..)

Get lowercased status of the machine.

machine.isRunning((err, running) => ..)

True if status is running.

machine.start(err => ..)

Start machine, if not already running.

machine.stop(err => ..)

Stop machine, if not already stopped.

machine.kill(err => ..)

Kill machine, if not already stopped.

machine.env([opts], (err, result) => ..)

Get the environment variables to dictate that Docker should run a command against a particular machine. By default, env() returns the output from docker-machine env as-is. That is, a script which can be run in a subshell. Options:

  • shell: custom shell. Ignored if parse is true.
  • parse: if true, result will be a plain object:
{
  DOCKER_TLS_VERIFY: '1',
  DOCKER_HOST: 'tcp://<ip>:<port>',
  DOCKER_CERT_PATH: '<home>/.docker/machine/machines/<name>',
  DOCKER_MACHINE_NAME: '<name>'
}

machine.ssh(command, (err, result) => ..)

Run a command via SSH. The command can be a string or an array.

machine.inspect((err, result) => ..)

Get the output of docker-machine inspect as a plain object with camelCase properties.

Static methods

All of the above methods (from status() to inspect()) are also accessible as static methods, where the first argument is a name. For example:

const Machine = require('docker-machine')

Machine.env('default', { json: true }, (err, result) => {
  console.log(result.DOCKER_HOST)
})

Machine.create(name, driver[, options], (err) => ..)

Create a machine. Options are driver-specific.

const options = {
  'virtualbox-memory': '1024'
}

Machine.create('test', 'virtualbox', options, (err) => {
  if (err) throw err
})

Machine.list([opts], (err, machines) => ..)

Get all machines as an array, via docker-machine ls. Each machine is a plain object with camelCase properties.

{
  name: 'agent-1',                  // Machine name
  activeHost: false,                // Is the machine an active host?
  activeSwarm: false,               // Is the machine an active swarm master?
  active: '*',                      // Human-readable combination of the above
  driverName: 'virtualbox',         // Driver name
  state: 'running',                 // Machine state (running, stopped)
  url: 'tcp://192.168.99.101:2376', // Machine URL
  swarm: null,                      // Machine swarm name
  dockerVersion: 'v1.12.0',         // Docker Daemon version
  responseTime: 980,                // Time taken by the host to respond (ms)
  error: null                       // Machine errors
}

Options:

  • timeout: ls timeout in seconds (see docker/machine#1696)
  • inspect: if true, also include the metadata from inspect() for each machine:
{
  name: 'agent-1',                  // Plus all of the above
  driver: {                         // Driver metadata
    cpu: 1,
    memory: 2048,
    hostOnlyCidr: '192.168.99.1/24',
    ..
  },
  hostOptions: {                    // Various host options
    engineOptions: ..
    swarmOptions: ..
  }
}

Install

With npm do:

npm install docker-machine

License

MIT © 2016-present Vincent Weevers

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].