Gathering detailed insights and metrics for dockerode-utils
Gathering detailed insights and metrics for dockerode-utils
Gathering detailed insights and metrics for dockerode-utils
Gathering detailed insights and metrics for dockerode-utils
Set of useful functions for working with dockerode
npm install dockerode-utils
Typescript
Module System
Node Version
NPM Version
84.2
Supply Chain
99.5
Quality
77.8
Maintenance
100
Vulnerability
99.6
License
TypeScript (100%)
Total Downloads
559,312
Last Day
135
Last Week
3,101
Last Month
10,952
Last Year
120,983
MIT License
5 Stars
17 Commits
1 Forks
3 Watchers
2 Branches
2 Contributors
Updated on Apr 30, 2024
Minified
Minified + Gzipped
Latest Version
0.0.7
Package Id
dockerode-utils@0.0.7
Size
7.63 kB
NPM Version
5.3.0
Node Version
8.0.0
Cumulative downloads
Total Downloads
Last Day
-22%
135
Compared to previous day
Last Week
26.9%
3,101
Compared to previous week
Last Month
33.2%
10,952
Compared to previous month
Last Year
12.9%
120,983
Compared to previous year
1
7
Set of useful functions for working with dockerode.
stdout
.npm
1npm install dockerode-utils --save
yarn
1yarn add dockerode-utils
pullImageAsync(dockerode, imageName, onProgress?)
1pullImageAsync(dockerode: Dockerode, imageName: string, onProgress?: (output: string) => void): void
Will pull docker image, you can wait for finish or track a progress. If you forget to specify
:tag
, it'll download :latest
1/** 2 * Example how to pull alpine:latest image from dockerhub 3 */ 4import * as Dockerode from 'dockerode'; 5import { pullImageAsync } from 'dockerode-utils'; 6 7const dockerode = new Dockerode(); 8await pullImageAsync(dockerode, 'alpine:latest');
execCommand(container, cmd)
1execCommand(container: Dockerode.Container, cmd: string[]): string[]
Execute shell command in container and returns output as string[]
.
1/** 2 * Print list of env from docker container 3 */ 4import * as Dockerode from 'dockerode'; 5import { execCommand } from 'dockerode-utils'; 6 7// first, we need to create a container 8const dockerode = new Dockerode(); 9const alpineContainer = await dockerode.run('alpine', [], {}, null); 10 11const envList = execCommand(alpineContainer, ['env']); 12console.log(envList); 13 14// command with argument 15const envList2 = execCommand(alpineContainer, ['env', '--help']); 16console.log(envList2);
waitForOutput(container, predicate, timeout = 15000)
1waitForOutput(container: Dockerode.Container, predicate: (output: string) => boolean, timeout: number = 15000)
Wait for specific output from container. Useful, when you're working with container, in which is running daemon and you have to wait for specific output/line to appears in container.
1/** 2 * Example with waiting for specific output. 3 * Here, we're waiting for 'InnoDB: 5.7.18 started' to appears in mysql container 4 * only after that, we know that mysql container is fully initialized and we can 5 * continue executing commands 6 */ 7 import * as Dockerode from 'dockerode'; 8 import { waitForOutput } from 'dockerode-utils'; 9 10const dockerode = new Dockerode(); 11const mysqlContainer = await dockerode.run('mysql:5.7.18', [], {}, null); 12 13await waitForOutput(mysqlContainer, (line) => line === 'InnoDB: 5.7.18 started'); 14console.log('MySql db started');
imageExists(dockerode, ...imageNames)
1imageExists(dockerode: Dockerode, ...imageNames: string | string[]): boolean
Check if images with imageNames
exist. You can check more than one image at once, like imageExists(dockerode, ['mongo', 'mysql'])
or only one imageExists(dockerode, 'mongo')
. In case, you won't define :tag
it'll check if any image with imageName
prefix exists.
Feel free to contribute with useful function that you're using daily and it can be helpful for others.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
no SAST tool detected
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
63 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
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