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
- Host: GitHub
- URL: https://github.com/dweinstein/docker-spawn
- Owner: dweinstein
- Created: 2015-12-14T19:50:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-14T19:58:55.000Z (over 9 years ago)
- Last Synced: 2025-01-12T03:27:47.702Z (4 months ago)
- Homepage:
- Size: 1000 Bytes
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);```