Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/dockerode
Advanced tools
TypeScript definitions for dockerode
@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://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dockerode.
These definitions were written by Carl Winkler, Nicolas Laplante, ByeongHun Yoo, Ray Fang, Marius Meisenzahl, Rob Moran, Cameron Diver, Pascal Sthamer, and Luis Rueda.
FAQs
TypeScript definitions for dockerode
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 0 open source maintainers 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.