Skip to content

LupCode/node-lup-docker

Repository files navigation

GitHub package.json version npm bundle size GitHub Workflow Status NPM

lup-docker

NodeJS library to interact with the Docker engine.

Example

JavaScript:

const Docker = require('lup-docker');

// List of all containers
const containers = await Docker.getContainers().then(result => result.success || []);
console.log(containers);

// Stream of a containers utilization stats
const statsStream = await Docker.getContainerStatsStream('busybox').then(result => result.success);
if(statsStream){
    const statsReader = statsStream.getReader();
    while(true){
        const { done, value } = await statsReader.read();
        if(done) break;

        // Process the stats data
        console.log(value);
    }
}

TypeScript:

import lupSystem from 'lup-docker';

// List of all containers
const containers = await Docker.getContainers().then(result => result.success || []);
console.log(containers);

// Stream of a containers utilization stats
const statsStream = await Docker.getContainerStatsStream('busybox').then(result => result.success);
if(statsStream){
    const statsReader = statsStream.getReader();
    while(true){
        const { done, value } = await statsReader.read();
        if(done) break;

        // Process the stats data
        console.log(value);
    }
}

About

NodeJS library to interact with a Docker engine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published