Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Dec 24, 2023 via pnpm

dockerode 2.5.1

Docker Remote API module.
Package summary
Share
0
issues
0
licenses
Package created
1 Sep 2013
Version published
8 Sep 2017
Maintainers
1
Total deps
0
Direct deps
0
License
Apache-2.0

Issues

0
This package has no issues

Frequently Asked Questions

What does dockerode do?

Dockerode is a Node.js module that provides an interface to interact with the Docker Remote API programmatically. It supports all Docker Remote API features, including using promises or callbacks for handling asynchronous operations. Dockerode also works with Docker streams, allowing direct manipulation and handling. It emphasizes a feature-rich environment, adhering to Docker changes quickly and effortlessly.

How do you use dockerode?

To use Dockerode, you'll first need to install it using npm as follows:

npm install dockerode

You can then import Dockerode into a JavaScript file and initiate Dockerode with various options. Here's how you can do this in your code:

var Docker = require('dockerode');
var docker = new Docker({socketPath: '/var/run/docker.sock'});

You can also specify different options while initiating Dockerode. For example:

var docker = new Docker({
  host: 'http://mydockerhost.com',
  port: process.env.DOCKER_PORT || 2375,
  ca: fs.readFileSync('ca.pem'),
  cert: fs.readFileSync('cert.pem'),
  key: fs.readFileSync('key.pem'),
  version: 'v1.25' // must correspond to Docker API version
});

Manipulating a Docker container would look like this:

// Create a container entity. Does not query API.
var container = docker.getContainer('71501a8ab0f8');

container.start(function (err, data) {
  console.log(data);
});

container.remove(function (err, data) {
  console.log(data);
});

You can also operate on containers using promise-based approaches. Dockerode accommodates both styles, aiming to make Docker operations as flexible as possible for developers.

Where are the dockerode docs?

The comprehensive Dockerode documentation can be found on the Docker API documentation page: https://docs.docker.com/engine/api/latest/. Detailed information about the Docker functions that Dockerode supports can be found right in the Dockerode readme file in the 'Documentation' section. Examples are also available to provide more specific use cases.