{"id":13563529,"url":"https://github.com/vweevers/node-docker-machine","last_synced_at":"2025-07-11T10:06:37.373Z","repository":{"id":56193880,"uuid":"63264174","full_name":"vweevers/node-docker-machine","owner":"vweevers","description":"Programmatic API to Docker Machine.","archived":false,"fork":false,"pushed_at":"2020-11-21T10:34:34.000Z","size":48,"stargazers_count":21,"open_issues_count":8,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-27T06:47:04.862Z","etag":null,"topics":["docker","docker-machine","machine","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vweevers.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-13T16:57:53.000Z","updated_at":"2021-04-19T16:58:57.000Z","dependencies_parsed_at":"2022-08-15T14:30:41.279Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/node-docker-machine","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/vweevers/node-docker-machine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fnode-docker-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fnode-docker-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fnode-docker-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fnode-docker-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/node-docker-machine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fnode-docker-machine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263389019,"owners_count":23459323,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-machine","machine","nodejs"],"created_at":"2024-08-01T13:01:20.303Z","updated_at":"2025-07-11T10:06:37.352Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","readme":"# docker-machine\n\n\u003e **Programmatic API to Docker Machine (0.6.0+).**  \n\u003e Wraps the [`docker-machine`](https://docs.docker.com/machine/reference/) CLI.\n\n[![node](https://img.shields.io/node/v/docker-machine.svg)](https://www.npmjs.org/package/docker-machine)\n[![npm status](http://img.shields.io/npm/v/docker-machine.svg)](https://www.npmjs.org/package/docker-machine)\n[![Travis build status](https://img.shields.io/travis/vweevers/node-docker-machine.svg?label=travis)](http://travis-ci.org/vweevers/node-docker-machine)\n[![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/node-docker-machine.svg?label=appveyor)](https://ci.appveyor.com/project/vweevers/node-docker-machine)\n[![Dependency status](https://img.shields.io/david/vweevers/node-docker-machine.svg)](https://david-dm.org/vweevers/node-docker-machine)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Table of Contents\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n- [Example](#example)\n- [API](#api)\n  - [`new Machine([name || opts])`](#new-machinename--opts)\n    - [`machine.status((err, status) =\u003e ..)`](#machinestatuserr-status--)\n    - [`machine.isRunning((err, running) =\u003e ..)`](#machineisrunningerr-running--)\n    - [`machine.start(err =\u003e ..)`](#machinestarterr--)\n    - [`machine.stop(err =\u003e ..)`](#machinestoperr--)\n    - [`machine.kill(err =\u003e ..)`](#machinekillerr--)\n    - [`machine.env([opts], (err, result) =\u003e ..)`](#machineenvopts-err-result--)\n    - [`machine.ssh(command, (err, result) =\u003e ..)`](#machinesshcommand-err-result--)\n    - [`machine.inspect((err, result) =\u003e ..)`](#machineinspecterr-result--)\n  - [Static methods](#static-methods)\n  - [`Machine.create(name, driver[, options], (err) =\u003e ..)`](#machinecreatename-driver-options-err--)\n  - [`Machine.list([opts], (err, machines) =\u003e ..)`](#machinelistopts-err-machines--)\n- [Install](#install)\n- [License](#license)\n\n\u003c/details\u003e\n\n## Example\n\n`node example.js ls /`\n\n```js\nconst Machine = require('docker-machine')\nconst cmd = process.argv.slice(2)\nconst machine = new Machine()\n\n// Start if not already started\nmachine.start(function (err) {\n  if (err) throw err\n\n  // Execute a command\n  machine.ssh(cmd, (err, result) =\u003e {\n    if (err) throw err\n    console.log(result)\n  })\n})\n```\n\n## API\n\n### `new Machine([name || opts])`\n\nOptions:\n\n- **name**: defaults to `DOCKER_MACHINE_NAME` or \"default\"\n\n#### `machine.status((err, status) =\u003e ..)`\n\nGet lowercased [status](https://docs.docker.com/machine/reference/status/) of the machine.\n\n#### `machine.isRunning((err, running) =\u003e ..)`\n\nTrue if status is `running`.\n\n#### `machine.start(err =\u003e ..)`\n\nStart machine, if not already running.\n\n#### `machine.stop(err =\u003e ..)`\n\nStop machine, if not already stopped.\n\n#### `machine.kill(err =\u003e ..)`\n\nKill machine, if not already stopped.\n\n#### `machine.env([opts], (err, result) =\u003e ..)`\n\nGet 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`](https://docs.docker.com/machine/reference/env/) as-is. That is, a script which can be run in a subshell. Options:\n\n- **shell**: custom shell. Ignored if `parse` is true.\n- **parse**: if true, `result` will be a plain object:\n\n```js\n{\n  DOCKER_TLS_VERIFY: '1',\n  DOCKER_HOST: 'tcp://\u003cip\u003e:\u003cport\u003e',\n  DOCKER_CERT_PATH: '\u003chome\u003e/.docker/machine/machines/\u003cname\u003e',\n  DOCKER_MACHINE_NAME: '\u003cname\u003e'\n}\n```\n\n#### `machine.ssh(command, (err, result) =\u003e ..)`\n\nRun a command via [SSH](https://docs.docker.com/machine/reference/ssh/). The `command` can be a string or an array.\n\n#### `machine.inspect((err, result) =\u003e ..)`\n\nGet the output of [`docker-machine inspect`](https://docs.docker.com/machine/reference/inspect/) as a plain object with camelCase properties.\n\n### Static methods\n\nAll of the above methods (from `status()` to `inspect()`) are also accessible as static methods, where the first argument is a `name`. For example:\n\n```js\nconst Machine = require('docker-machine')\n\nMachine.env('default', { json: true }, (err, result) =\u003e {\n  console.log(result.DOCKER_HOST)\n})\n```\n\n### `Machine.create(name, driver[, options], (err) =\u003e ..)`\n\nCreate a machine. Options are driver-specific.\n\n```js\nconst options = {\n  'virtualbox-memory': '1024'\n}\n\nMachine.create('test', 'virtualbox', options, (err) =\u003e {\n  if (err) throw err\n})\n```\n\n### `Machine.list([opts], (err, machines) =\u003e ..)`\n\nGet all machines as an array, via [`docker-machine ls`](https://docs.docker.com/machine/reference/ls/). Each machine is a plain object with camelCase properties.\n\n```js\n{\n  name: 'agent-1',                  // Machine name\n  activeHost: false,                // Is the machine an active host?\n  activeSwarm: false,               // Is the machine an active swarm master?\n  active: '*',                      // Human-readable combination of the above\n  driverName: 'virtualbox',         // Driver name\n  state: 'running',                 // Machine state (running, stopped)\n  url: 'tcp://192.168.99.101:2376', // Machine URL\n  swarm: null,                      // Machine swarm name\n  dockerVersion: 'v1.12.0',         // Docker Daemon version\n  responseTime: 980,                // Time taken by the host to respond (ms)\n  error: null                       // Machine errors\n}\n```\n\nOptions:\n\n- **timeout**: `ls` timeout in seconds (see [docker/machine#1696](https://github.com/docker/machine/issues/1696))\n- **inspect**: if true, also include the metadata from `inspect()` for each machine:\n\n```js\n{\n  name: 'agent-1',                  // Plus all of the above\n  driver: {                         // Driver metadata\n    cpu: 1,\n    memory: 2048,\n    hostOnlyCidr: '192.168.99.1/24',\n    ..\n  },\n  hostOptions: {                    // Various host options\n    engineOptions: ..\n    swarmOptions: ..\n  }\n}\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install docker-machine\n```\n\n## License\n\n[MIT](LICENSE) © 2016-present Vincent Weevers\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fnode-docker-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fnode-docker-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fnode-docker-machine/lists"}