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 🙏

© 2024 – Pkg Stats / Ryan Hefner

dolphin

v0.1.14

Published

A fast and lightweight module to interact with docker deamons

Downloads

3,815

Readme

Dolphin

dolphin

A fast, lightweight an modular library to interact with docker daemons.

This module provides a thin layer to communicate with docker daemons in node. The api is promise and events based trying to follow the semantics of docker's remote api as closely as possible.

Install

npm install dolphin

Usage

Instantiation

Before starting to interact with docker deamons you need to instantiate dolphin. If you are using docker-machine, and the env vars are set by docker-machine env mymachine, then you can just instantiate it without args. If no env variables are set, it will use dockers default Unix domain socket: unix:///var/run/docker.sock.

var dolphin = require('dolphin')();

You can also instantiate it with an explicit url pointing to the docker daemon:

var Dolphin = require('dolphin');

var dolphin = Dolphin({
	url: 'http://mydockerhost.com: 1234'
})

Version

You can ask dolphin for the docker engine version installed:

dolphin.version().then(function(version){
	...
})

Or some system wide information:

dolphin.info().then(function(info){
	...
})

Images

Containers

You can get a list of all the containers running on the system using the container method:

dolphin.containers().then(function(containers){
	// Containers contains an array of docker containers.
	// https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#list-containers
})

// Query parameters are also supported, so that you can get a subset of the containers
dolphin.containers({
	all: {Boolean},	// Show all containers even stopped ones.
	limit: {Integer},
	since: {Integer}, // Show containers created since given timestamp
	before: {Integer}, // Show containers created before given timestamp
	size: {Boolean},
	filters: {Object}, // Eg. {"exited":0, "status":["restarting","running","paused","exited"]}
}).then(function(containers){

})

Container methods

There are several useful methods for querying containers:

dolphin.containers.inspect(containerId).then(function(info){
	// Container info
})
dolphin.containers.logs(containerId).then(function(logs){
	// Container logs
})
dolphin.containers.changes(containerId).then(function(changes){
	// Container changes
})
dolphin.containers.export(containerId).then(function(export){
	// Container info
})
dolphin.containers.stats(containerId).then(function(stats){
	// Container stats
})

Events

A very powerful featue in dolphin is the ability to listen to events generated by docker deamons.

It can show live or old events, depending on the options used:

dolphin.events({
	since: Date.now() / 1000,
	until: Date.now() / 1000
}).on('event', function(evt){
	console.log(evt);
}).on('error', function(err){
	console.log('Error:', err);
});

See which events are produced by docker here: https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24/#/monitor-docker-s-events

Volumes

Networks

Nodes

Services