gia-ast
Version:
A CLI Wrapping AST Web API calls to servers
23 lines (16 loc) • 462 B
JavaScript
// 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);
});