Gathering detailed insights and metrics for node-docker-api
Gathering detailed insights and metrics for node-docker-api
Gathering detailed insights and metrics for node-docker-api
Gathering detailed insights and metrics for node-docker-api
@redocly/cli
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility. It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make API g
@verdaccio/commons-api
Commons API utilities for Verdaccio
@types/docker-modem
TypeScript definitions for docker-modem
dockerode
Docker Remote API module.
npm install node-docker-api
87.1
Supply Chain
97.9
Quality
74.8
Maintenance
100
Vulnerability
80.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
308 Stars
120 Commits
50 Forks
5 Watching
7 Branches
13 Contributors
Updated on 26 Nov 2024
Minified
Minified + Gzipped
TypeScript (81.6%)
JavaScript (17.35%)
Shell (1.05%)
Cumulative downloads
Total Downloads
Last day
-4.9%
7,273
Compared to previous day
Last week
4.5%
42,529
Compared to previous week
Last month
-13.7%
176,964
Compared to previous month
Last year
28.6%
2,014,048
Compared to previous year
2
Docker Remote API driver for node.js. It uses the same modem than dockerode, but the interface is promisified and with a different syntax.
Support for:
The current status of the package is in beta state. This module covers the full API reference, including experimental stuff such as plugins.
Check the reference and the tests for full examples.
1$ npm install node-docker-api
You can find more into the examples folder
1'use strict'; 2const {Docker} = require('node-docker-api'); 3 4const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 5 6docker.container.create({ 7 Image: 'ubuntu', 8 name: 'test' 9}) 10 .then(container => container.start()) 11 .then(container => container.stop()) 12 .then(container => container.restart()) 13 .then(container => container.delete({ force: true })) 14 .catch(error => console.log(error));
1'use strict'; 2const {Docker} = require('node-docker-api'); 3 4const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 5 6// List 7docker.container.list() 8 // Inspect 9 .then(containers => containers[0].status()) 10 .then(container => container.top()) 11 .then(processes => console.log(processes)) 12 .catch(error => console.log(error));
1'use strict'; 2const {Docker} = require('node-docker-api'); 3 4const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 5 6// List 7docker.container.list() 8 // Inspect 9 .then(containers => containers[0].status()) 10 .then(container => container.stats()) 11 .then(stats => { 12 stats.on('data', stat => console.log('Stats: ', stat.toString())) 13 stats.on('error', err => console.log('Error: ', err)) 14 }) 15 .catch(error => console.log(error));
1'use strict'; 2const {Docker} = require('node-docker-api'); 3 4const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 5let container; 6 7docker.container.create({ 8 Image: 'ubuntu', 9 name: 'test' 10}) 11 .then(container => container.logs({ 12 follow: true, 13 stdout: true, 14 stderr: true 15 })) 16 .then(stream => { 17 stream.on('data', info => console.log(info)) 18 stream.on('error', err => console.log(err)) 19 }) 20 .catch(error => console.log(error));
1const {Docker} = require('node-docker-api'); 2const fs = require('fs'); 3 4const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 5let container; 6 7docker.container.create({ 8 Image: 'ubuntu', 9 name: 'test' 10}) 11 .then(container => container.start()) 12 .then(container => container.export()) 13 .then(content => { 14 const file = fs.createWriteStream("container.tar"); 15 file.end(content) 16 }) 17 .catch(error => console.log(error));
1'use strict'; 2const fs = require('fs'); 3const {Docker} = require('node-docker-api'); 4 5const promisifyStream = stream => new Promise((resolve, reject) => { 6 stream.on('data', data => console.log(data.toString())) 7 stream.on('end', resolve) 8 stream.on('error', reject) 9}); 10 11const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 12let container; 13 14docker.container.create({ 15 Image: 'ubuntu', 16 Cmd: [ '/bin/bash', '-c', 'tail -f /var/log/dmesg' ], 17 name: 'test' 18}) 19 .then(container => container.start()) 20 .then(_container => { 21 container = _container 22 return _container.fs.put('./file.tar', { 23 path: 'root' 24 }) 25 }) 26 .then(stream => promisifyStream(stream)) 27 .then(() => container.fs.get({ path: '/var/log/dmesg' })) 28 .then(stream => { 29 const file = fs.createWriteStream("file.jpg"); 30 stream.pipe(file); 31 return promisifyStream(stream); 32 }) 33 .then(() => container.status()) 34 .then(container => container.stop()) 35 .catch(error => console.log(error));
1'use strict'; 2const {Docker} = require('node-docker-api'); 3 4const promisifyStream = stream => new Promise((resolve, reject) => { 5 stream.on('data', data => console.log(data.toString())) 6 stream.on('end', resolve) 7 stream.on('error', reject) 8}); 9 10const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 11let _container; 12 13docker.container.create({ 14 Image: 'ubuntu', 15 Cmd: [ '/bin/bash', '-c', 'tail -f /var/log/dmesg' ], 16 name: 'test' 17}) 18 .then(container => container.start()) 19 .then(container => { 20 _container = container 21 return container.exec.create({ 22 AttachStdout: true, 23 AttachStderr: true, 24 Cmd: [ 'echo', 'test' ] 25 }) 26 }) 27 .then(exec => { 28 return exec.start({ Detach: false }) 29 }) 30 .then(stream => promisifyStream(stream)) 31 .then(() => _container.kill()) 32 .catch(error => console.log(error));
1'use strict'; 2const {Docker} = require('node-docker-api'); 3const tar = require('tar-fs'); 4 5const promisifyStream = stream => new Promise((resolve, reject) => { 6 stream.on('data', data => console.log(data.toString())) 7 stream.on('end', resolve) 8 stream.on('error', reject) 9}); 10 11const docker = new Docker({ socketPath: '/var/run/docker.sock' }); 12 13var tarStream = tar.pack('/path/to/Dockerfile') 14docker.image.build(tarStream, { 15 t: 'testimg' 16}) 17 .then(stream => promisifyStream(stream)) 18 .then(() => docker.image.get('testimg').status()) 19 .then(image => image.remove()) 20 .catch(error => console.log(error));
1'use strict'; 2const {Docker} = require('node-docker-api'); 3 4const promisifyStream = (stream) => new Promise((resolve, reject) => { 5 stream.on('data', (d) => console.log(d.toString())) 6 stream.on('end', resolve) 7 stream.on('error', reject) 8}) 9 10const docker = new Docker({ socketPath: '/var/run/docker.sock' }) 11 12return docker.image.create({}, { fromImage: 'ubuntu', tag: 'latest' }) 13 .then(stream => promisifyStream(stream)) 14 .then(() => docker.image.get('ubuntu').status()) 15 .then(image => image.history()) 16 .then(events => console.log(events)) 17 .catch(error => console.log(error))
1'use strict' 2const fs = require('fs'); 3const {Docker} = require('node-docker-api'); 4 5const promisifyStream = stream => new Promise((resolve, reject) => { 6 stream.on('data', data => console.log(data.toString())) 7 stream.on('end', resolve) 8 stream.on('error', reject) 9}) 10 11const docker = new Docker({ socketPath: '/var/run/docker.sock' }) 12 13docker.events({ 14 since: ((new Date().getTime() / 1000) - 60).toFixed(0) 15}) 16 .then(stream => promisifyStream(stream)) 17 .catch(error => console.log(error))
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 9/29 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
74 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More