Giter Club home page Giter Club logo

nodoecker's Introduction

Circle CI

Nodöcker (nodoecker)

A node/docker API designed to mimic the UI from the Docker CLI as much as possible. The Docker REST API doesn't map very clearly, and if you have experience with using the CLI, you're going to be spend a lot of time reading the API docs to figure out how to do the same things. This attempts to fix that.

And yes it uses promises. This was designed to work with Koa so it's promises. But it will use the built-in Promise object if it exists. And bluebird if not.

Don't like promises? Perhaps you should read "We have a problem with promises".

Install

npm i -S nodoecker

Usage

var Nodeocker = require('nodeocker');
// If you are working with private images, you can login to the docker registry
// by passing the following object into the constructor
var authObj = {
  username: 'test',
  password: 'test',
  email: '[email protected]'
};
var nd = new Nodeocker('/var/run/docker.sock', authObj);
nd
  .pull('busybox:latest')
  .then(function(busybox) {
    return busybox.Inspect();
  })
  .then(function(busybox) {
    console.log(busybox.size);
    return nd.run('myBusybox', 'busybox');
  })
  .then(function(myBusybox) {
    return myBusybox.Inspect();
  })
  .then(function(myBusybox) {
    console.log(myBusybox.Cmd[0]);
    console.log(myBuxbox.ExposedPorts);
  })
  .catch(function(err) {
    console.log('O NOES', err);
  });

Implemented API

It only implements a portion subset of the Docker API current:

  • Pulling images [docker pull]
  • Creating containers [docker run]
  • Stopping containers [docker stop]
  • Restarting containers [docker restart]
  • Inspecting containers and images [docker inspect]
  • Getting image history [docker history]
  • Listing all images available [docker images]
  • Listing all running containers [docker ps]

Pull-Requests to implement more of the API or to provide better alignment against the CLI versus the exposed parts of the API are very welcome!

Tests

npm test

It will attempt to talk to Docker via /var/run/docker.sock. If your Docker daemon is running in a different place you can specify it by setting the DOCKER_SOCK environment variable.

DOCKER_SOCK=http://127.0.0.1:9000 npm test

Licenese

Apache 2.0; Copyright © 2015 Scripto

nodoecker's People

Contributors

toddself avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodoecker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.