An open API service indexing awesome lists of open source software.

https://github.com/dweinstein/docker-spawn

node.js ChildProcess.spawn for running docker containers
https://github.com/dweinstein/docker-spawn

Last synced: 2 months ago
JSON representation

node.js ChildProcess.spawn for running docker containers

Awesome Lists containing this project

README

        

# docker-spawn
Node.js ChildProcess.spawn for running docker containers

# usage

```js

var spawn = require('.').spawn;

var ps = spawn('mitmdump', [], {
stdio: ['ignore', process.stdout, process.stderr],
config: {
Image: 'mitmproxy/releases:0.14',
Tty: false,
OpenStdin: false,
Binds: [
'/Users/user/share:/data'
],
PortBindings: {
'8080/tcp': [ { HostIp: '', HostPort: '8080' } ]
}
}
});

ps.stdout.pipe(process.stdout);
ps.stderr.pipe(process.stderr);

ps.on('close', function (code, signal) {
console.log('exited with code', code, signal);
});

console.log('container name:', ps.container);

setTimeout(function () {
ps.kill('SIGKILL');
}, 10000);

```