Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/dockerode

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/dockerode

TypeScript definitions for dockerode

  • 3.3.27
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/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.

What are @types/dockerode's main functionalities?

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);
});

Other packages similar to @types/dockerode

FAQs

Package last updated on 03 Apr 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc