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

@types/dockerode

Package Overview
Dependencies
Maintainers
0
Versions
87
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.32
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
574K
decreased by-5.99%
Maintainers
0
Weekly downloads
 
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 18 Nov 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