24 lines
No EOL
468 B
JavaScript
24 lines
No EOL
468 B
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var docker = require('../bin/dockerode');
|
|
|
|
|
|
|
|
router.get('/:id', (req, res, next) => {
|
|
getContainer(id).then(data => {
|
|
res.send(data);
|
|
});
|
|
});
|
|
|
|
|
|
function getContainer(containername) {
|
|
return new Promise((resolve, reject) => {
|
|
const container = docker.getContainer(containername);
|
|
container.inspect((err, data) => {
|
|
resolve({ err, data });
|
|
});
|
|
})
|
|
}
|
|
|
|
|
|
module.exports = router; |