Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@types/dockerode
Advanced tools
@types/dockerode provides TypeScript type definitions for the dockerode library, which is a Node.js module for managing Docker containers and images. It allows developers to interact with Docker's API in a type-safe manner, making it easier to write and maintain code that manages Docker resources.
Managing Docker Containers
This feature allows you to create and start Docker containers programmatically. The code sample demonstrates how to create a container from the 'ubuntu' image and start it.
const Docker = require('dockerode');
const docker = new Docker();
docker.createContainer({ Image: 'ubuntu', Cmd: ['/bin/bash'] }, function (err, container) {
container.start(function (err, data) {
console.log('Container started');
});
});
Managing Docker Images
This feature allows you to pull Docker images from a registry. The code sample demonstrates how to pull the 'ubuntu' image and track the progress of the download.
const Docker = require('dockerode');
const docker = new Docker();
docker.pull('ubuntu', function (err, stream) {
docker.modem.followProgress(stream, onFinished, onProgress);
function onFinished(err, output) {
console.log('Image pulled');
}
function onProgress(event) {
console.log(event);
}
});
Inspecting Docker Containers
This feature allows you to inspect the details of a Docker container. The code sample demonstrates how to retrieve and log the details of a container with a specific ID.
const Docker = require('dockerode');
const docker = new Docker();
docker.getContainer('container_id').inspect(function (err, data) {
console.log(data);
});
Listing Docker Containers
This feature allows you to list all Docker containers. The code sample demonstrates how to retrieve and log a list of all containers, including stopped ones.
const Docker = require('dockerode');
const docker = new Docker();
docker.listContainers({ all: true }, function (err, containers) {
console.log(containers);
});
docker-cli-js is a Node.js module that provides a simple interface to interact with Docker using the command line interface (CLI). Unlike dockerode, which interacts directly with the Docker API, docker-cli-js executes Docker CLI commands and parses the output. This can be useful for scenarios where you prefer or need to use the Docker CLI.
node-docker-api is another Node.js module for interacting with Docker's API. It provides a promise-based interface, which can be more convenient for handling asynchronous operations compared to dockerode's callback-based approach. It also offers a more modern and streamlined API design.
dockerode-promise is a wrapper around dockerode that adds promise support. This package allows you to use promises instead of callbacks when working with dockerode, making it easier to write and manage asynchronous code. It is particularly useful for developers who prefer using promises or async/await syntax.
npm install --save @types/dockerode
This package contains type definitions for dockerode (https://github.com/apocas/dockerode).
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dockerode
Additional Details
These definitions were written by Carl Winkler https://github.com/seikho, Nicolas Laplante https://github.com/nlaplante.
FAQs
TypeScript definitions for dockerode
The npm package @types/dockerode receives a total of 236,620 weekly downloads. As such, @types/dockerode popularity was classified as popular.
We found that @types/dockerode demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.