npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dockercode-manager

v1.0.0

Published

a logger for express router

Readme

Docker Manager

一个基于 Node.js 的 Docker 容器管理工具,基于 dockerode 封装,提供简单易用的 Docker 容器生命周期管理功能。

特性

  • 自动拉取和启动Docker镜像
  • 管理容器的启动和停止
  • 支持容器配置选项(端口映射、环境变量、数据卷等)
  • 维护运行中和已停止容器的状态列表
  • 支持批量操作多个容器

安装

npm install docker-manager

基本使用

const DockerManager = require('docker-manager');

// 创建管理器实例
const manager = new DockerManager();

// 配置容器
const containers = [{
  name: 'nginx:latest',
  options: {
    HostConfig: {
      PortBindings: {
        '80/tcp': [{ HostPort: '8080' }]
      }
    }
  }
}];

// 初始化并启动容器
await manager.init(containers);

// 停止所有容器
await manager.stop();

API

构造函数

  • new DockerManager() - 创建Docker管理器实例

方法

  • init(imageList, IsStartContainer) - 初始化并启动多个Docker镜像
  • pullImage(Image, IsStartContainer) - 拉取并可选启动Docker镜像
  • startContainer(Image) - 启动指定的Docker容器
  • stop(IsRemoveContainer) - 停止所有正在运行的容器
  • stopContainer(Image, IsRemoveContainer) - 停止指定的容器
  • getRunningContainerList() - 获取运行中的容器列表
  • getStoppingContainerList() - 获取已停止的容器列表

配置选项

容器配置对象支持以下选项:

{
  name: 'nginx:latest',           // 镜像名称和标签
  containerName: 'nginx-server',  // 可选,容器名称
  options: {
    HostConfig: {
      PortBindings: {            // 端口映射
        '80/tcp': [{
          HostPort: '8080'
        }]
      }
    },
    Env: ['NODE_ENV=production'], // 环境变量
    Volumes: {                    // 数据卷
      '/data': {}
    },
    ExposedPorts: {              // 暴露端口
      '80/tcp': {}
    }
  }
}

许可证

MIT

相关链接