New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-docker-api

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-docker-api - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

test/test-load.tar

9

lib/image.js

@@ -287,6 +287,6 @@ 'use strict';

return new Promise(function (resolve, reject) {
_this7.modem.dial(call, function (err, stream) {
_this7.modem.dial(call, function (err, res) {
if (err) return reject(err);
var image = new Image(_this7.modem, id);
resolve(Object.assign(image, conf));
resolve(image);
});

@@ -322,3 +322,3 @@ });

statusCodes: {
201: true,
200: true,
404: 'no such image',

@@ -352,3 +352,3 @@ 409: 'conflict',

var call = {
path: '/images/' + id + '?',
path: '/images/search?',
method: 'GET',

@@ -484,2 +484,3 @@ options: opts,

}
if (!opts) opts = {};
return [opts, id];

@@ -486,0 +487,0 @@ }

{
"name": "node-docker-api",
"version": "1.0.4",
"version": "1.0.5",
"description": "Docker Remote API driver for node",

@@ -5,0 +5,0 @@ "main": "./lib/docker",

# docker-api
Docker Remote API driver for node.js. It uses the same modem than [dockerode](https://github.com/apocas/docker), but the implementation is promisified and with a different syntax.
Docker Remote API driver for node.js. It uses the same modem than [dockerode](https://github.com/apocas/docker), but the interface is promisified and with a different syntax.

@@ -14,3 +14,3 @@ Support for:

The current status of the package is in development. From the [API reference](https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24), there's full support and test for section 3.1 and 3.3, experimental support for section 3.2. The rest of the API is still pending.
The current status of the package is in development. From the [API reference](https://docs.docker.com/engine/reference/api/docker_remote_api_v1.24), there's full support and test for sections 3.1, 3.2 and 3.3.

@@ -17,0 +17,0 @@ ## Installation

@@ -215,6 +215,6 @@ 'use strict'

return new Promise((resolve, reject) => {
this.modem.dial(call, (err, stream) => {
this.modem.dial(call, (err, res) => {
if (err) return reject(err)
let image = new Image(this.modem, id)
resolve(Object.assign(image, conf))
resolve(image)
})

@@ -239,3 +239,3 @@ })

statusCodes: {
201: true,
200: true,
404: 'no such image',

@@ -264,3 +264,3 @@ 409: 'conflict',

const call = {
path: `/images/${id}?`,
path: `/images/search?`,
method: 'GET',

@@ -374,4 +374,5 @@ options: opts,

}
if (!opts) opts = {};
return [ opts, id ]
}
}
import chai from 'chai'
import fs from 'fs'
import * as test_utils from './utils'
import Image from '../lib/image'
const should = chai.should()
let docker = test_utils.init()
let containerNames = new Map([
[ 'list', 'docker_api_test_list' ],
])
let testImage = 'ubuntu:latest'
describe('#image', function () {
describe('#list', function () {
it('should receive an array of images', function () {
this.timeout(30000)
return docker.image.list()
.then((images) => {
images.should.be.an('array')
})
})
})
describe('#build', function () {
it('should build an image from file and remove it', function () {
this.timeout(300000)
return docker.image.build('./test/test.tar', { t: 'test' })
.then((stream) => {
stream.pipe.should.be.ok
return new Promise((resolve, reject) => {
let res = []
stream.on('end',() => resolve(Buffer.concat(res).toString()))
stream.on('data', (d) => res.push(d))
stream.on('error', reject)
})
})
.then((result) => {
return docker.image.status('test')
})
.then((image) => {
return image.remove()
})
})
})
describe('#create', function () {
it('should create an image from another', function () {
this.timeout(300000)
return docker.image.create({ fromImage: 'ubuntu' })
.then((stream) => {
stream.pipe.should.be.ok
})
})
})
describe('#status', function () {
it('should check status of an image', function () {
this.timeout(30000)
return docker.image.status(testImage)
.then((image) => {
image.should.be.instanceof(Image)
})
})
})
describe('#history', function () {
it('should return history of an image', function () {
this.timeout(30000)
return docker.image.history(testImage)
.then((data) => {
data.should.be.an('array')
})
})
})
describe('#tag', function () {
it('should tag an image', function () {
this.timeout(30000)
return docker.image.tag({ tag: 'test', repo: 'root' }, testImage)
.then((image) => {
image.should.be.instanceof(Image)
return image.status()
})
.then((image) => {
image.RepoTags.indexOf('root:test').should.not.be.equal(-1)
})
})
})
describe('#search', function () {
it('should search an image in docker hub', function () {
this.timeout(300000)
return docker.image.search({ term: 'ubuntu' })
.then((results) => {
results.should.be.an('array')
})
})
})
describe('#load', function () {
it('should load an image from file', function () {
this.timeout(300000)
return docker.image.build(fs.createReadStream('./test/test.tar'))
.then((stream) => {
stream.pipe.should.be.ok
})
})
})
})
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