UNPKG

gia-ast

Version:
23 lines (16 loc) 462 B
#!/usr/bin/env node // Import the Dockerode library const Docker = require('dockerode'); // Create a Docker client const docker = new Docker(); // Get a list of running containers docker.listContainers({ all: true }, (err, containers) => { if (err) { console.error(err); return; } // Convert the list of containers to JSON format const json = JSON.stringify(containers, null, 2); // Print the JSON to the console console.log(json); });